Ssky-keygen + ssh-copy-id without a password to log on to a remote LINUX host

Source: Internet
Author: User
In the following example, ssky-keygen and ssh-copy-id can be used to log on to a remote Linux host without a password. Ssh-keygen creates the public key and key. Ssh-copy-id copies the public key of the local host to the authorized_keys file of the remote host. Ss... use ssky-keygen and ssh-copy-id in the following example. you can log on to the remote Linux host without entering a password. Ssh-keygen creates the public key and key. Ssh-copy-id copies the public key of the local host to the authorized_keys file of the remote host. The ssh-copy-id will also be sent to the user home directory (home) and ~ of the remote host ~ /. Ssh, and ~ /. Ssh/authorized_keys. Step 1: use ssh-key-gen to create the public key and key ligh @ local-host $ ssh-keygen-t rsaEnter file in which to save the key (/home/jsmith /. ssh/id_rsa): [Enter key] Enter passphrase (empty for no passphrase): [Press enter key] Enter same passphrase again: [Pess enter key] Your identification has been saved in/home/jsmith /. ssh/id_rsa.Your public key has been saved in/home/jsmith /. ssh/id_rsa.pub. the key fingerprint is: 33: B3: fe: af: 95: 95: 18: 11: 31: d5: de: 96: 2f: f2: 35: f9 ligh @ local-host Step 2: use ssh-copy-id to copy the public key to the remote host. ligh @ local-host $ ssh-copy-id-I ~ /. Ssh/id_rsa.pub root@192.168.0.3ligh @ remote-host's password: Now try logging into the machine,? Ssh? Remote-host '', and check in :. ssh/authorized_keys to make sure we haven't added extra keys that you weren' t expecting. [Note: The ssh-copy-id appends the key to the remote host. ssh/authorized_key.] step 3: log on to the remote host ligh @ local-host $ ssh remote-host Last login: Sun Nov 16 17:22:33 2008 from 192.168.1.2 [Note: SSH will not ask for the password.] ligh @ remote-host $ [Note: you have logged on to the remote host now]
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.