Solved

How to set up SSH on Free BSD?

Posted on 2002-05-12
8
332 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

911 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now