Mac client Password-free login to CentOS server

Source: Internet
Author: User
Tags centos server

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

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.