Linux operating system-two Linux server ssh password-free login

Source: Internet
Author: User

A is a local host (that is, the machine used to control other hosts); b is the remote host (that is, the controlled machine server), IP is 192.168.100.247; The systems A and B are all Linux commands on a.
# Ssh-keygen-T RSA (three consecutive returns, i.e. locally generated public and private keys, no password set) # SSH [email protected]192.168.100.247"  mkdir. Ssh;chmod 0700. SSH"  (requires a password, note: You must set the. SSH permission to A.) # SCP ~/.ssh/id_rsa.pub [email protected]:.ssh /id_rsa.pub (need to enter a password)

command on B:

# touch/root/.ssh/ ~/.ssh/authorized_keys  (# Note: You must change the permissions of ~/.ssh/authorized_keys to 600, This file is used to save the public key generated by the SSH client and can modify the server'sSSH service-side configuration file/etc/ssh//root/.ssh/id_rsa.pub  >>/root/.ssh/authorized _keys (Append id_rsa.pub content to Authorized_keys, be careful not to use >, otherwise it will empty the original content, so that others can not use the original key to log in)


Back to a machine:

# SSH [email protected]192.168.100.247 (no password required, login successful)

If you specify a different file name when generating the key pair (or if you need to control n machines, you will generate a multi-pair key), you need to specify the private key file with the parameter-I

# SSH [email protected]192.168.100.247 (no password required, login successful)

Linux SCP Remote replication command

SCP local_file [email protected]_ip:remote_folder such as SCP sample.zip [email protected] 192.168. 100.247 /usr/local

Password-free login is configured so that you do not need to enter the code when executing the SCP

Linux operating system-two Linux server ssh password-free login

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.