Client modifies hosts
Server-side Modify host name
Vi/etc/sysconfig/network
Networking=yes
Hostname=node1
To modify the mappings between host names and IPs
Vim/etc/hosts
192.168.1.101 Node1
Generate public and private keys on Mac client command line
CD ~/.ssh
SSH-KEYGEN-T RSA
Always enter.
2 Sending the public key id_rsa.pub to the CentOS server side ~/.SSH
(
If there is no. ssh folder on the server, the login server is created by entering the following command
mkdir ~/.ssh
chmod ~/.ssh
)
Log on to the service side
CD ~/.ssh
Cat Id_rsa.pub >> Authorized_keys
chmod Authorized_keys Note: Must be set to 600
Errors that may be encountered:
Error 1:ssh can ' t be established or warning:permanently added
Modify the configuration of the Vi/etc/ssh/ssh_config file, and this problem will not occur again in the future
Last side add:
Stricthostkeychecking No
Userknownhostsfile/dev/null
Why don't you understand?
Try it on first, http://blog.chinaunix.net/uid-29485627-id-4232920.html.
Error 2:SSH login prompt Permission denied please try again
Modify the Vi/etc/ssh/sshd_config file. Find the following sentence
#PermitRootLogin Yes
You need to remove the previous # number.
Permitrootlogin Yes
Restarting the SSHD server
Service sshd Restart
Question 3
Resolve the inconsistency between the local login user and the remote login user
Well, this is very tangled, although not to enter the password, but also have to SSH [email protected] to log in, modify the local login user's ~/.ssh/config (Mac client) file, if the wood has to build a bar, the content is as follows:
Host hostname
User username
Host hostname2
User UserName2
Such as
Host Node1
User root
Host Node2
User root
Host Node3
User root
In this way, the local and remote login user name inconsistency can also ssh hostname login.
Mac client Password-free login to CentOS server