(1) the configuration file openSSH related to SSH is stored in the/etc/ssh/directory, which includes the following files:/etc/ssh/sshd_config: the setting file/etc/ssh/ssh_config of the sshd server: the setting file/etc/of the ssh client /... (1) the configuration file openSSH related to SSH is stored in the/etc/ssh/directory, which includes the following files:/etc/ssh/sshd_config: the sshd server's setting file/etc/ssh/ssh_config: the setting file of the ssh client/etc/ssh/ssh_host_key: RSA private key for SSH1/etc/ssh/ssh_host_key.pub: RSA public key for SSH1/etc/ssh/ssh_host_rsa_key: RSA private key for SSH2/etc/ssh/ssh_host_rsa_key.pub: RS for SSH2 A public key/etc/ssh/ssh_host_dsa_key: DSA private key for SSH2/etc/ssh/ssh_host_dsa_key.pub: DSA public key for SSH2 (2) configure the "/etc/ssh/ssh_config" File "/etc/ssh/ssh_config" as the configuration file for the OpenSSH system, you can set different options to change the running mode of the client program. Each line of this file contains a keyword-value match, where the keyword is case-insensitive. The most important keywords are listed below. you can use the man command to view the help page (ssh (1) to obtain a detailed list. Edit the "ssh_config" file (vi/etc/ssh/ssh_config) to add or change the following parameters: # Site-wide defaults for various options Host * ForwardAgent no ForwardX11 no RhostsAuthentication no longer no RSAAuthentication yes PasswordAuthentication yes FallBackToRsh no UseRsh no BatchMode no CheckHostIP yes no IdentityFile ~ /. Ssh/identity Port 22 Cipher blowfish EscapeChar ~ The following line-by-line description of the above option settings: Host *: only valid for computers that can match the strings below. "*" Indicates all computers. ForwardAgent no: "ForwardAgent" sets whether the connection has been verified and the proxy (if any) is forwarded to the remote computer. ForwardX11 no: Sets whether the X11 connection is automatically redirected to a secure channel and DISPLAY set ). RhostsAuthentication no: whether to use rhosts-based security verification. RhostsRSAAuthentication no: whether to use the rhosts-based security verification of the RSA algorithm. RSAAuthentication yes: whether to use the RSA algorithm for security verification. PasswordAuthentication yes: Password verification. FallBackToRsh no: whether to use rsh automatically if an error occurs during ssh connection. UseRsh no: whether to use "rlogin/rsh" on this computer ". BatchMode no: if it is set to "yes", The passphrase/password (interactive password input) prompt will be disabled. This option is useful for script files and batch processing tasks when a password cannot be entered interactively. CheckHostIP yes: set ssh to check the IP address of the host connected to the server to prevent DNS spoofing. We recommend that you set it to "yes ". StrictHostKeyChecking no: if it is set to "yes", ssh will not automatically add the computer's key to "$ HOME /. ssh/known_hosts, and the connection is denied once the computer's key changes. IdentityFile ~ /. Ssh/identity: specifies the file from which the RSA security authentication ID is read. Port 22: Set the Port to connect to the remote host. Cipher blowfish: Set the password used for encryption. EscapeChar ~: Set the escape character. Assume that you have an account named "baby" on www.super.com. In addition, we need to combine "ssh-agent" and "ssh-add" and use data compression to speed up transmission. Because the host name is too long, you want to use "super" as the abbreviation of "www.super.com. The configuration file can be written as follows: host * super HostName www.super.com User baby ForwardAgent yes Compression yes # Be paranoid by default Host * ForwardAgent no ForwardX11 no FallBackToRsh no after the User inputs "ssh super, SSH will automatically find the full name of the host from the configuration file, log on with the user name, and use the key managed by "ssh-agent" for security verification. (3) configure the "/etc/ssh/sshd_config" File "/etc/ssh/sshd_config" as the configuration file of OpenSSH, and allow the setting options to change the running of this daemon. Each line of this file contains a keyword-value match, where the keyword is case-insensitive. The following are the most important keywords. you can use the man command to view the help page (sshd (8) to obtain a detailed list. Edit the "sshd_config" file (vi/etc/ssh/sshd_config) and add or change the following parameters: # This is ssh server systemwide configuration file. port 22 ListenAddress 192.168.1.1 HostKey/etc/ssh/ssh_host_key ServerKeyBits 1024 running 600 KeyRegenerationInterval 3600 PermitRootLogin no IgnoreRhosts yes StrictModes yes X11Forwarding no PrintMotd yes SyslogFacility AUTH LogLevel INFO enabled No RhostsRSAAuthentication no RSAAuthentication yes PasswordAuthentication yes PermitEmptyPasswords no AllowUsers admin specifies the above option settings line by line: Port 22: "Port" sets the Port number of the sshd listener. ListenAddress 192.168.1.1: "ListenAddress" sets the IP address bound to the sshd server. HostKey/etc/ssh/ssh_host_key: "HostKey" sets the file containing the private key of the computer. ServerKeyBits 1024: "ServerKeyBits" defines the number of digits of the server key. LoginGraceTime 600: "LoginGraceTime" sets the server wait time (in seconds) before the connection is disconnected if the user cannot log on successfully ). KeyRegenerationInterval 3600: "KeyRegenerationInterval" sets the number of seconds after which the server key is automatically regenerated (if the key is used ). Re-generate the key to prevent the theft of the key to decrypt the intercepted information. PermitRootLogin no: "PermitRootLogin" sets whether the root user can log on via ssh. Do not set this option to "yes ". IgnoreRhosts yes: "IgnoreRhosts" sets whether to use the "rhosts" and "shosts" files for verification. IgnoreUserKnownHosts yes: "IgnoreUserKnownHosts" sets whether ssh daemon ignores the user's "$ HOME/. ssh/known_hosts" during RhostsRSAAuthentication security verification ". StrictModes yes: "StrictModes" sets whether ssh checks the permission and ownership of the user's directory and rhosts file before receiving logon requests. This is usually necessary because new users often set their directories and files to write permissions for anyone. X11Forwarding no: "X11Forwarding" sets whether to allow X11 forwarding. PrintMotd yes: "PrintMotd" sets whether sshd displays the information in "/etc/motd" when the user logs on. SyslogFacility AUTH: "SyslogFacility" sets whether to provide "facility code" when recording messages from sshd ". LogLevel INFO: "LogLevel" sets the level for logging sshd log messages. INFO is a good choice. View the man help page of sshd to obtain more information. RhostsAuthentication no: "RhostsAuthentication" is used only for rhosts or "/etc/hosts. equiv" for security verification. RhostsRSAAuthentication no: "RhostsRSA" sets whether to allow the use of rhosts or "/etc/hosts. equiv" and RSA for security verification. RSAAuthentication yes: "RSAAuthentication" sets whether only RSA Security authentication is allowed. PasswordAuthentication yes: "PasswordAuthentication" sets whether password verification is allowed. PermitEmptyPasswords no: "PermitEmptyPasswords" sets whether to allow logon with an account with an empty password. AllowUsers admin: "AllowUsers" can be followed by matching strings such as any number of user names (patterns) or user @ host. These strings are separated by spaces. The host name can be a DNS name or IP address.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service