mmedwid
asked on
How to set up SSH on Free BSD?
Looks for assistance in setting up a Free BSD box to be reachable via SSH and to have SSH load on this box each time it is started. Thanks.
Hi mmedwid,
1. Download a copy of SSH from the following site:
http://www.openssh.com/
or somewhere else if you alread know.
2. Following the instructions (README file etc) install
it on your system
(eg, put it under /usr/local)
3. use a text edtor to edit the ssh configuration files (I assume that you install it under /usr/local)
/usr/local/etc/ssh_config
/usr/local/etc/ssh_config
note: you can use all the default setting first and make
the change later.
4. cd to the ssh bin dir, run the following command:
./ssh-keygen -t dsa
Note: this will generates authentication keys
for your system
5. Modify the following script (I wrote this one for my systems) and put it under /etc/rc2.d,
========================== ========== ========== ======
#!/sbin/sh
# This script is for start and stop the OpenSSH daemon -- sshd
#
# OpenSSH configuration files location: /usr/local/etc
# OpenSSH key files location: /etc/ssh2
#
# Generic script used to start and stop a service
case "$1" in
'start')
# Start the sshd server
if [ -f /usr/local/sbin/sshd ]; then
/usr/local/sbin/sshd &
fi
;;
'stop')
pid=`ps -ef | grep sshd | grep -v grep | awk '{print $2} ' `
if test "$pid" ; then
/usr/bin/kill $pid
else
echo "No PID file. Process may not be running"
fi
;;
*)
echo "Usage: /etc/init.d/sshd { start | stop }"
;;
esac
exit 0
#========================= ========== ========== =========
Save it as S91sshd, and set the permission as the followings:
-rwxr--r-- 1 root sys 818 Nov 21 11:20 S91sshd*
6. Start the sshd deamon (ssh server):
/etc/rc2.d/S91sshd start
That's all you need to do.
Good luck!
=============
yuzh
1. Download a copy of SSH from the following site:
http://www.openssh.com/
or somewhere else if you alread know.
2. Following the instructions (README file etc) install
it on your system
(eg, put it under /usr/local)
3. use a text edtor to edit the ssh configuration files (I assume that you install it under /usr/local)
/usr/local/etc/ssh_config
/usr/local/etc/ssh_config
note: you can use all the default setting first and make
the change later.
4. cd to the ssh bin dir, run the following command:
./ssh-keygen -t dsa
Note: this will generates authentication keys
for your system
5. Modify the following script (I wrote this one for my systems) and put it under /etc/rc2.d,
==========================
#!/sbin/sh
# This script is for start and stop the OpenSSH daemon -- sshd
#
# OpenSSH configuration files location: /usr/local/etc
# OpenSSH key files location: /etc/ssh2
#
# Generic script used to start and stop a service
case "$1" in
'start')
# Start the sshd server
if [ -f /usr/local/sbin/sshd ]; then
/usr/local/sbin/sshd &
fi
;;
'stop')
pid=`ps -ef | grep sshd | grep -v grep | awk '{print $2} ' `
if test "$pid" ; then
/usr/bin/kill $pid
else
echo "No PID file. Process may not be running"
fi
;;
*)
echo "Usage: /etc/init.d/sshd { start | stop }"
;;
esac
exit 0
#=========================
Save it as S91sshd, and set the permission as the followings:
-rwxr--r-- 1 root sys 818 Nov 21 11:20 S91sshd*
6. Start the sshd deamon (ssh server):
/etc/rc2.d/S91sshd start
That's all you need to do.
Good luck!
=============
yuzh
pid="`ps -ef|awk '/\/s\shd/{print $2}'`" # ;-)
Sorry, I was not thinking, you should put the script in:
/etc/rc.local.
We are talking about free BSD.
/etc/rc.local.
We are talking about free BSD.
ASKER
Thanks. I'll try this out tomorrow. Working from home today.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yeah - this is what I found reading through one of the docs. I like the simple approach.
Then setup /etc/sshd_config and start sshd.