


Specifies a source restriction or from-stanza, restricting the set of IP addresses or host names from which the reverse-mapped DNS names from which the key can be used.

Specifies an environment variable and its value to be added to the environment before executing shell or command. It is a common error when configuring SFTP file transfers to accidentally omit this option and permit shell access. Without this option, the key grants unlimited access as that user, including obtaining shell access. The effect is to limit the privileges given to the key, and specifying this options is often important for implementing the principle of least privilege. This is also called command restriction or forced command. command="cmd"įorces a command to be executed when this key is used for authentication. We strongly recommend against using this option, as using OpenSSH certificates for user authentication makes it impossible to audit who has access to the server by inspecting server configuration files, and no trustworthy OpenSSH certificate authority exists. Indicates that the key should be trusted as a certificate authority to validate proprietary OpenSSH certificates for authenticating as that user. The following options are supported in authorized_keys files. The public key may be preceded by options that control what can be done with the key. Lines starting with # and empty lines are ignored.Įach line contains a public SSH key. In OpenSSH, a user's authorized keys file lists keys that are authorized for authenticating as that user, one per line. Such tools can handle keys in root-owned locations and alert if a root user installs an unauthorized key. In a locked-down environment, a proper key management tool such as Universal SSH Key Manager would normally be used. It is almost too easy, and that is one of the reasons why the number of SSH keys has become so uncontrolled. New key pairs can be generated using the ssh-keygen program and the ssh-copy-id tool can be used for copying keys in an authorized_keys file on a server. Support for the AuthorizedKeysCommand may also be an important consideration, particularly in cloud environments. When selecting a solution for managing SSH keys, it is important to ensure it understands SSH configuration files and can parse the locations where keys are stored, and is able to deal with custom builds used in the organization, if any. A common use of this option is to fetch authorized keys from an LDAP directory. The program gets as argument the user name for which to look for keys. The AuthorizedKeysCommand option can be used to specify a program that is used to fetch authorized keys for a user. For example, /var/ssh/%u/ak would cause the SSH server to look for authorized keys for the user jane from /var/ssh/jane/ak. %% is replaced by literal %, %h by the home directory of the user being authenticated, and %u by the login name of the user. The option may contain more than one location, separated by spaces. The AuthorizedKeysFile configuration option in /etc/ssh/sshd_config specifies where the SSH server looks for authorized keys. Some organizations use custom OpenSSH builds with different default paths. Many OpenSSH versions also look for ssh/authorized_keys2. ssh/authorized_keys in the user's home directory. With OpenSSH, the authorized keys are by default configured in. Contents Location of the Authorized Keys File Generating New Keys Format of the Authorized Keys File cert-authority command="cmd" environment="NAME=value" from="pattern-list" no-agent-forwarding no-port-forwarding no-pty no-user-rc no-x11-forwarding permitopen="host:port" principals="principals" tunnel="n" Key Management for OpenSSH Location of the Authorized Keys File
