Friday, 12 September 2014

Install and Configuration OpenSSH in FreeBSD

SSH is a secure version of telnet. It’a a protocol used to access the console or command line for remote system.

1. Installation

localhost# cd /usr/ports/security/openssh-portable

localhost# make config ; make install clean

2.  Configure

localhost# cp /etc/make.conf /etc/make.conf.old

localhost#  echo “NO_OPENSSH = YES” >> /etc/make.conf

localhost# cd /etc/ssh/

localhost# cp sshd_config sshd_config.old

localhost# cp sshd_config-dist ssh_config

localhost# /etc/rc.d/sshd restart

Stopping sshd.

Starting sshd.

localhost#ee /etc/rc.conf

add command :  sshd_enable=”YES”

this command is used to start ssh automatically

3. Testing

localhost# telnet localhost 22

Trying 127.0.0.1…

Connected to localhost.

Escape character is ‘^]’.

SSH-2.0-OpenSSH_5.1p1 FreeBSD-openssh-portable-overwrite-base-5.1.p1,1

press enter to quit. You should now be able to connect with any SSH-capable client and any valid user account other than root.

HowTo: Install or Upgrade Base OpenSSH for FreeBSD

Different methods to get the base installation of OpenSSH to be upgraded or installed.
### PORTS ###
from ports:

cd /usr/ports/security/openssh-portable
make UPDATE_INTREE_OPENSSH=yes
make install
make clean
### OR ###
for OpenSSL:

cd /usr/ports/security/openssl
make -DOPENSSL_OVERWRITE_BASE install
openssl version
for OpenSSH:

cd /usr/ports/security/openssh-portable
make -DOPENSSH_OVERWRITE_BASE=yes install
sshd -V
### PORTUPGRADE ###
for portinstall or portupgrade, prepare the MAKE_ARGS in /usr/local/etc/pkgtools.conf:

vi /usr/local/etc/pkgtools.conf

Look for an empty MAKE_ARGS and add the following to look like this:

MAKE_ARGS = {
'security/openssl' => 'OPENSSL_OVERWRITE_BASE=yes',
'security/openssh-portable' => 'OPENSSH_OVERWRITE_BASE=yes',
}
using portinstall:

portinstall -rRm "OPENSSH_OVERWRITE_BASE=yes" /usr/ports/security/openssh-portable/
using portupgrade:

portupgrade -rR openssh-portable-overwrite-base