SSH Automatic logon script

Source: Internet
Author: User

SSH generally to enter a password, automatically set the method has two: 1. Through expect to establish#!/usr/bin/expect-f # expect in which directory with Whereis to find, different system expect installation path is not the same, if # is not installed in the installation CD some set Timeout-1spawn ssh-l user_name Host_name/ipexpect "Password:" send "your_password\n" interact #用exact这个指令是为了把控制权交给用户 to start the remote operation Note: 1. Because the user name and password are involved in this file So to set the user's permissions in addition to the user do not let anyone read him or create a password file 2.expect script Although it is a script but can not be executed with the SH command, and the general shell script can be executed with SH, otherwise the file is unreadable error message 2.ssh KeyIf the login B (192.168.2.12) machine is implemented on a (192.168.2.11) machine, then the command below is executed on a machine.ssh-keygen-t RSA then all returns use the default settingsin the user's home directory there will be a. Ssh/id_rsa. Ssh/id_rsa.pub put ~/.ssh/id_rsa.pub on the B-machine .SCP ~/.ssh/id_rsa.pub [email protected]:/dir_name Login to 192.168.2.12 cat $dir _name/id_rsa.pub >> ~/.ssh/authorized_keys
chmod ~/.ssh/authorized_keysAfter the end can be on the 192.168.2.11 with SSH password-free login 192.168.2.12 PS: If not successful landing then, it is necessary to check the permissions problems and SELinux and iptables try not to copy and paste the way, directly with the file cover

SSH Automatic logon script

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.