Solved

How to set up SSH on Free BSD?

Posted on 2002-05-12
8
335 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.

733 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