HowTo: Second SSH daemon using SMF in Solaris 10
In some cases, it may be a good idea to run separate SSH daemons -- one internal and one external.
Here's how I did it using the new SMF method.
1) New Config
cd /etc
cp -rp ssh ssh_copy
cd ssh_copy
rm ssh_host_*
vi sshd_config
change to desired port
add line for alternate PID i.e. "PidFile /var/run/ssh_copy.pid"
2) SMF method
cd /lib/svc/method
cp -rp sshd sshd_copy
edit the new file using the diff below:
# diff sshd sshd_copy
8c8
< SSHDIR=/etc/ssh
---
> SSHDIR=/etc/ssh_copy
10c10
< PIDFILE=/var/run/sshd.pid
---
> PIDFILE=/var/run/sshd_copy.pid
53c53
< /usr/lib/ssh/sshd
---
> /usr/lib/ssh/sshd -f $SSHDIR/sshd_config
3) SMF manifest
cd /var/svc/manifest/network
cp -rp ssh.xml ssh_copy.xml
edit the new file using the diff below:
# diff ssh.xml ssh_copy.xml
18c18
< name='network/ssh'
---
> name='network/ssh_copy'
74c74
< value='file://localhost/etc/ssh/sshd_config' />
---
> value='file://localhost/etc/ssh_copy/sshd_config' />
78c78
< name='ssh_multi-user-server'
---
> name='ssh_copy_multi-user-server'
88c88
< exec='/lib/svc/method/sshd start'
---
> exec='/lib/svc/method/sshd_copy start'
100c100
< exec='/lib/svc/method/sshd restart'
---
> exec='/lib/svc/method/sshd_copy restart'
113c113
< value='solaris.smf.manage.ssh' />
---
> value='solaris.smf.manage.ssh_copy' />
4) Add to SMF repository
svccfg validate /var/svc/manifest/network/ssh_copy.xml
svccfg import /var/svc/manifest/network/ssh_copy.xml
5) Starting new SSH service
svcadm enable ssh_copy