Archive for June, 2012

Enabling SSH on Boot in FreeBSD

Sunday, June 3rd, 2012

In FreeBSD, the SSH daemon does not automatically run on start up after a fresh installation. To change this, add the following line to /etc/rc.conf:


You use any text editor to edit /etc/rc.conf, but if you wish to remain on the command line, simply appending the above line to /etc/rc.conf will get the job done:

[root@mediaserver3 ~]# echo ‘sshd_enable=”YES”‘ >> /etc/rc.conf

This will start sshd the next time the system restarts. If you’re unwilling or unable to restart your system at the moment, but still want to enable SSH until the next reboot, use:

[root@mediaserver3 ~]# service sshd start

See the FreeBSD Handbook’s section on OpenSSH for more.

Note: By default, only unprivileged users will be able to login over SSH. If you wish to allow logins from root over ssh, you’ll need to enable the PermitRootLogin option in /etc/ssh/sshd_config. Keep in mind that FreeBSD is a heavily security-minded distribution, and that enabling root logins via SSH is generally seen as an ill-advised move.

Further, by default, root can only login from a local terminal or console. That is, in a regular install of FreeBSD, an unprivileged user cannot elevate their privileges to super user status through the su command unless you specifically granted them that ability by adding them to the wheel group.