SSH mutual trust Configuration
Specific Configuration:
Disable iptables and SELinux
1. Open the ssh configuration file and enable the following options:
Vim/etc/ssh/sshd_config
RSAAuthentication yes # Allow RSA Authentication
PubkeyAuthentication yes # Allow Public Key Authentication
AuthorizedKeysFile. ssh/authorized_keys # public key storage address
# PermitRootLogin yes if you want to log on as a root user using ssh mutual trust, do not enable this project.
2. Restart the ssh service.
/Etc/init. d/sshd restart
3. Generate the public key and private key:
Ssh-keygen-t rsa-P ""
-P indicates the password, and-P "" indicates that the password is empty, or you do not need the-P parameter. In this case, you have to press enter three times and press enter once with-P.
The default value is ~ /. The ssh directory generates two files, Private Key id_rsa and Public Key id_rsa.pub.
4. Import the public key to the authentication file and change the permission.
2.1 import to the authorized_keys file of the Local Machine (for backup)
Cat ~ /. Ssh/id_rsa.pub> ~ /. Ssh/authorized_keys
2.2 import to the authorized_keys file for password-free login to the server
First, copy the public key to the server.
Scp ~ /. Ssh/id_rsa.pub xxx @ host:/home/id_rsa.pub
Then, import the public key to the authentication file (this step is performed on the other server)
Shell code: cat/home/id_rsa.pub> ~ /. Ssh/authorized_keys
2.3 Change permissions on the server
Chmod 700 ~ /. Ssh
Chmod 600 ~ /. Ssh/authorized_keys
5. Test Logon
Ssh 192.168.111.111
If ssh is not the default port, add the-p port number after the ssh command.
For example:
Ssh-p 10000 192.168.111.111
6. Disconnect ssh Login
Exit
7. multiple servers have mutual ssh trust. Only the above operations can be performed on multiple servers.
You may also like the following SSH-related articles. For details, refer:
Complete SSH service configuration and troubleshooting in Ubuntu
How to install Samba and SSH server in Ubuntu 14.04
SSH service remote access to Linux Server login is slow
How to Improve the SSH login authentication speed of Ubuntu
Enable the SSH service to allow Android phones to remotely access Ubuntu 14.04
How to add dual authentication for SSH in Linux
Configure the SFTP environment for non-SSH users in Linux
Configure and manage the SSH service on Linux
This article permanently updates the link address: