Three ways to achieve SSH automatic login

Source: Internet
Author: User
Tags ssh config
To achieve SSH automatic login, there are three main methods: 1, the generation of public private key. 2, write expect script. 3, with Sshpass.
Usage:

Sshpass parameter SSH command (SSH,SFTP,SCP, etc.).
Parameters:
-p password//password The parameter as a password.
-F passwordfile//Extract the first line of the file Passwordfile as a password.
-E//Sshpass the environment variable as a password.

For example:
SCP Abc@192.168.0.5:/home/xxx/test/root The purpose of this command is to upload server-side file test to the local folder/root.
Using Sshpass, assuming that the password is Efghi, you can write:
Ssh-p Efghi SCP Abc@192.168.0.5:/home/xxx/test/root

In addition, for SSH's first landing, will be prompted: "Are you sure your want to continue connecting (yes/no)", then use Sshpass will not work, the solution: 1. You can add-o stricth after the ssh command Ostkeychecking=no to solve. such as the above command, you can write ssh-p Efghi scp abc@192.168.0.5:/home/xxx/test/root-o stricthostkeychecking=no. 2. Or write the configuration file: The Stricthostkeychecking No add to/etc/ssh/ssh config can let SSH client automatically accept the new host Hostkey, do not have to input each time to compile arm version, in Sshpass Directory execution:./configure./make CC=ARM-LINUX-GCC Automatic file transfer:./sshpass-p 111111./scp-s/ssh-o. Stricthostkeychecking=no-r St.file testuser@192.168.0.10:./

Sshpass relies on PTS, if PST is not loaded, execute

Bash Code mknod-m 666/dev/ptmx C 5 2   #chmod 666/dev/ptmx   mkdir/dev/pts                   #编辑/etc/fstab, join:          none            /dev/pts          devpts         gid=5, Mode=620    0 0      mount/dev/pts  

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.