Remember the password using ssh

Source: Internet
Author: User
Remember the password using ssh. Preface: In development, because you sometimes need to log on to the remote server through ssh, you have to enter the password every time. it is hard to remember the password and it is very troublesome, so I searched the internet and used ssh to automatically log on to the remote server, saving the trouble of entering a password every time. The system says... remember the password using ssh. in development, sometimes you need to log on to the remote server through ssh and enter the password every time. it is hard to remember the password and it is very troublesome, so I searched the internet and used ssh to automatically log on to the remote server, saving the trouble of entering a password every time. System Description: Local Machine: Debian remote machine: centos step:. modifications to the local machine 1. use ssh-keygen to generate an RSA public-private key pair # ssh-keygen all the way, press enter, and finally in ~ /. Generate the id_rsa and id_rsa.pub files in the ssh folder and change the permissions of the. ssh directory by running the command "chmod 755 ~ /. Ssh "code: [user1 @ rh user1] $ chmod 755 ~ /. Ssh 2. in ~ /. Create a config file in the ssh folder as follows: Host abc // server alias HostName xxx. xxx. xxx. xxx // server IP address User root // Port 22 // ssh service Port note: If you need to configure remote hosts, add another record to the config text file, the format is the same as above. 3. Upload The id_rsa.pub file to the remote server through gftp ~ /. B. modifications required by remote machines 1. open the File "/etc/ssh/sshd_config" in vi and comment out "#" in front of the following lines to get RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile. ssh/authorized_keys 2. create in the root directory of the user. ssh folder. if it already exists, you do not need to create it. the specific path is (~ /. Ssh) # cd ~ /. Ssh create the authorized_keys file in the. ssh folder. remember that authorized_keys is a file, not a folder. Copy and paste the content in the id_rsa.pub file uploaded by the client to authorized_keys, and save authorized_keys. Enter chmod 644 authorized_keys3. restart the ssh service command # service sshd restart C. return to the linux client on the local machine for testing and input the command in the terminal # ssh abc // note that abc is the server alias configured in the config file and directly enters the remote server. is it very convenient, haha. Note: If a bad owers error occurs in this step, you need to change the name of the. ssh folder and the file permissions in it. the specific command is as follows: # chmod 700 ~ /. Ssh # chmod go + rwx ~ /. Ssh /*
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.