Modifying Solaris Services
Recently I ran into an issue: the sshd service on a Solaris 10 box needed to be used with a custom configuration file. By default, the sshd service will use /etc/ssh/sshd_config. I needed it to use /etc/ssh/sshd_config_custom. I could not just modify the default configuration file. Don’t ask why – it’s complicated. So here’s what I ended up doing and this process is applicable to modifying any other Solaris 10 (and above) service:
See what SSH services are running on the system
|
1 2 3 |
# svc | grep ssh online 16:00:01 svc:/network/ssh:default |
Get the details for the “network/ssh” service
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# svcs -l network/ssh fmri svc:/network/ssh:default name SSH server enabled true state online next_state none state_time Thu Sep 09 16:00:01 2010 logfile /var/svc/log/network-ssh:default.log restarter svc:/system/svc/restarter:default contract_id 146 dependency require_all/none svc:/system/filesystem/local (online) dependency optional_all/none svc:/system/filesystem/autofs (online) dependency require_all/none svc:/network/loopback (online) dependency require_all/none svc:/network/physical (online) dependency require_all/none svc:/system/cryptosvc (online) dependency require_all/none svc:/system/utmp (online) dependency require_all/restart file://localhost/etc/ssh/sshd_config (online) |
Create custom sshd configuration file. For this example we will just make a copy of the default sshd_config and then rename the default file to something else.
|
1 2 |
cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config_custom mv /etc/ssh/sshd_config /etc/ssh/ssh_config_old |
Edit the ssh.xml file containing service configuration details for network/ssh service
|
1 |
vi /var/svc/manifest/network/ssh.xml |
Find the following line:
|
1 |
value='file://localhost/etc/ssh/sshd_config />' |
And change it to:
|
1 |
value='file://localhost/etc/ssh/sshd_config_custom />' |
Edit the sshd startup file:
|
1 |
vi /lib/svc/method/sshd |
Fine the following line in the “start” section of the “case” function:
|
1 |
/usr/lib/ssh/sshd |
And change it to:
|
1 |
/usr/lib/ssh/sshd -f /etc/ssh/sshd_config_custom |
Finally, restart sshd service:
|
1 |
svcadm restart network/ssh |
And you are done. They sure made managing services startup easier in Solaris 10
-
che-che
-
Picean
-
Bryan J
