Product SiteDocumentation Site

Chapter 2. OpenSSH as a Server

2.1. Configuration Options
2.2. Cryptographic Logon
Setting up OpenSSH on your server isn't difficult. Most settings are found in the /etc/ssh/sshd_config file. It is important to understand the settings in the file, however, as failure to properly configure OpenSSH could lead to your system being vulnerable to attack.

2.1. Configuration Options

In your /etc/ssh/sshd_config you will see several settings (and some you will not see) for setting up OpenSSH as a service. Information on all possible choices within the /etc/ssh/sshd_config can be found by man sshd_config.
A number of defaults are present in Fedora 18 that are designed to make OpenSSH Server more secure. The first option is to enable ONLY the SSH v2 protocol (Protocol 2). The second is to disable empty passwords (PermitEmptyPasswords no). Lines beginning with a # are commented out and not read by the daemon, but the commented out options in the default configuration file are the active defaults.
Root login is enabled by default and can be controlled with the PermitRootLogin option. The following controls are available for PermitRootLogin:
yes - enable root login
PermitRootLogin directives
OptionFunction
noRoot is not allowed to log in via ssh, at all.
without-passwordRequire a public-key (pubkey) to connect
forced-commands-onlyConnect as root and execute commands as configured in ~/.ssh/authorized_keys
Example 2.1. More about forced-commands
The forced-commands-only option provides the ability to lock down what can be done with a utility key or keys without passwords. As an example, for running backups...
forced-commands-only commands are added to ~/.ssh/authorized_keys on the line with the key being used to connect. /usr/bin/ls -l" ssh-rsa AAA...wnp 'key-comment'

Other sshd options
OptionUsage
Banner /path/to/filenameDisplays file contents on ssh login to all users
Ciphers aes128-ctr,blowfish-cbcComma separated? list of encryption ciphers that OpenSSH will accept. See man sshd_config for the full list.
AllowUsers or DenyUsersSpecify allowed or denied users by username
AllowGroups or DenyGroupsAllow or deny users by their group associations

Applying changes

The OpenSSH server must be restarted to activate any changes. systemctl restart sshd.service