Solved

How to set up SSH on Free BSD?

Posted on 2002-05-12
8
331 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
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…
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…
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…

708 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

17 Experts available now in Live!

Get 1:1 Help Now