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.
Who is Participating?
StirchConnect With a Mentor Commented:
May be you should try to add fillowing line to /etc/rc.conf -
sshd_enadle = "YES"
you need to add the /path/to/sshd to the rc startup script, probably /etc/rc.local
Then setup /etc/sshd_config and start sshd.
Hi mmedwid,

  1. Download a copy of SSH from the following site:
  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)
  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,

  # 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 the sshd server
        if [ -f /usr/local/sbin/sshd ]; then
                 /usr/local/sbin/sshd &
       pid=`ps -ef | grep sshd | grep -v grep | awk '{print $2} ' `
       if test "$pid" ;  then
        /usr/bin/kill $pid
              echo "No PID file. Process may not be running"
      echo "Usage: /etc/init.d/sshd { start | stop }"
  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!
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

pid="`ps -ef|awk '/\/s\shd/{print $2}'`"  # ;-)
Sorry, I was not thinking, you should put the script in:

We are talking about free BSD.
mmedwidAuthor Commented:
Thanks.  I'll try this out tomorrow.  Working from home today.  
May be you need to read this as well:
mmedwidAuthor Commented:
Yeah - this is what I found reading through one of the docs.  I like the simple approach.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.