One. Service scene: Ali So, Linux version-CentOS client scene: Mac OS X Terminal
In terminal the SSH command login service every time you want to enter the password, of course, can copy/paste the password, but after a period of time does not operate, the operator will be active disconnect, the connection must copy/paste the password, or some is not convenient. There is no way to achieve login without input password. There is a way, this blog share is the solution.
Does not enter the password, the service how verifies the client. Through the process certificate, the certificate is like the door card when you enter the office door. When the client is logged in, the door card (certificate) is brushed on the Service Board (certificate verification), the service will check the door card can not open the door. How to build a door card, how to tell the door card information to the manager. Answer the question with the following operating steps.
1. On the local machine, open your wallet CD ~/the door card. ssh/
If you don't have a wallet, go and buy one:
mkdir ~/. Ssh
2. Building the Access Card
Ssh-keygen-t RSA wants you to enter the name, you can enter it at will,
Default door card filename: id_rsa.pub
3. Copy a door card and place it in the wallet SCP id_rsa.pub username@server:~/. ssh/
4. Login to the server (you need to enter the password), take the card from the server wallet, remove the information in this, put the dedicated mezzanine ssh Username@server your access card to the trusted list of remote hosts: Cat Id_rsa.pub >>. Ssh/authorized_keys
5. The door card rm id_rsa.pub in the wallet of the burnt handle
6. Exit the manager exit
7. Login again without input password ssh username@server
Welcome Houyi VM System!
[Root@aliyun-cnblogs ~]#
No password code SSH login is so simple.
If you have already generated the public and private key on the target host:
You can log in in the following way
deploy@user-ubuntu:~/ssh_key$ chmod xxx.id_rsa*
deploy@user-ubuntu:~/ssh_key$ ssh-i/home/deploy/ssh_key/xxx.id_rsa username@ip-p Port
Two. If you feel that each time you enter: SSH root@42.121.108.144 Although you can not enter the password, but you think it is not easy to remember such a long string, you can use the following method:
Edit this file for you: VI ~/.CSHRC
Get the following output:
#. CSHRC
# User specific aliases and functions
Alias RM ' Rm-i '
Alias CP ' Cp-i '
Alias MV ' Mv-i '
Add statement on last line: alias s ' ssh root@42.121.108.144 '
You may also want to modify the/etc/profile file
Add the following characters to the last line: Alias s= ' ssh root@42.121.108.144 '
Then close the current console and open a new console input s command to use it.
Next time you can use only one s as the command to log on to a remote host, very handy.
As follows:
[Root@centos64 ~]# S
Last login:wed June 19:26:57 2013 from 116.234.192.93
Welcome Houyi VM System!
[root@ay121111100212ac7878 ~]#
Landing success ...