Solved

How to set up SSH on Free BSD?

Posted on 2002-05-12
8
334 Views
Last Modified: 2010-04-21
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.
0
Comment
Question by:mmedwid
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7005305
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.
0
 
LVL 38

Expert Comment

by:yuzh
ID: 7005312
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
 
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7005325
pid="`ps -ef|awk '/\/s\shd/{print $2}'`"  # ;-)
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 38

Expert Comment

by:yuzh
ID: 7005345
Sorry, I was not thinking, you should put the script in:
/etc/rc.local.

We are talking about free BSD.
0
 
LVL 1

Author Comment

by:mmedwid
ID: 7006298
Thanks.  I'll try this out tomorrow.  Working from home today.  
0
 
LVL 38

Expert Comment

by:yuzh
ID: 7007776
May be you need to read this as well:

http://www.freebsd.org/handbook/openssh.html
0
 
LVL 1

Accepted Solution

by:
Stirch earned 200 total points
ID: 7023343
May be you should try to add fillowing line to /etc/rc.conf -
sshd_enadle = "YES"
0
 
LVL 1

Author Comment

by:mmedwid
ID: 7024444
Yeah - this is what I found reading through one of the docs.  I like the simple approach.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question