Configure password-free SSH access between Linux servers

Source: Internet
Author: User
Tags free ssh ssh access oracle vm virtualbox vm virtualbox

Environment: Oracle VM Virtualbox, Ubuntu Server 12.04,securecrt

1, first installed in the virtual machine Linux operating system, here I choose is Ubuntu Server, in order to facilitate the follow-up operation, the network recommends bridging (bridge), because the computer is older, virtual machines and Linux are 32-bit

When installing Ubuntu, be careful to choose to install the SSH service, if not installed, can be installed by the following command:

$sudo Apt-get Install Openssh-server

Use the following command to see if the SSH service has started:

$ps-E |        grep ssh 6606?        00:00:00 sshd10284?        00:00:00 sshd10453? 00:00:00 sshd

If not, you can start with a command:

$sudo/etc/init.d/ssh start# configuration file:/etc/ssh/sshd_config# If you modify the configuration file, you will need to restart the SSH service $sudo/etc/init.d/ssh restart

2. Set up static IP after installing Ubuntu (all Linux servers need to be set up)

$vi/etc/network/interfaces# This file describes the network interfaces available on your system# and what to activate them .  For more information, see Interfaces (5). # The loopback network Interfaceauto loiface Lo inet loopback# the primary Network Interfaceauto eth0iface eth0 inet staticaddress 192.168.1.100 #其它Linux服务器的IP需设置在同一网段netmask 255.255.255.0gateway 192.168.1.1

You can query whether IP is set correctly through the Ifconfig command

3, SSH password-free configuration (192.168.1.101 is my other Ubuntu IP)

$ssh  192.168.1.101# This time prompt need password, enter the correct password, will connect to the corresponding host # exit the target host, start configuration $ssh-keygen -t rsagenerating  public/private rsa key pair. enter file in which to save the key  (/HOME/SWEET/.SSH/ID_RSA):    #不输入任何东西, Direct carriage return enter passphrase  (empty for no passphrase):   #不输入任何东西, Direct Enter enter same passphrase again:   #不输入任何东西, direct carriage return ... $ls  -a# You can see that the command just created a. SSH hidden folder $cd .ssh$ls -ltotal 12-rw------- 1 sweet sweet 1679  Dec 21 11:56 id_rsa-rw-r--r-- 1 sweet sweet  394 Dec  21 11:56 id_rsa.pub-rw-r--r-- 1 sweet sweet 1110 dec 21 21:19  known_hosts# can use the Cat command to see the contents of the Id_rsa and id_rsa.pub files, a bunch of characters that don't understand # Copy the public key file to another server   need to execute on another server Ssh-keygen  -t rsa create the. SSH folder $scp ./id_rsa.pub [email protected]:/home/sweet/.ssh/authorized_keys# Note that the Authorized_keys permission of the target machine is-rw-r--r--, if it is not necessary to perform Chmod 644 authorized_keys modify the file permissions $ssh  192.168.1.101# this time to execute this command can be directly logged in, no need to enter the password

After doing the same steps on another server, you can sign in with each other without a password.

? ?? NOTE: If you configure Hadoop, you need to natively be able to password-free access to the computer, directly append the public key file Id_rsa.pub file to Authorized_keys ? ? ?

$cat id_rsa.pub >> Authorized_keys


Configure password-free SSH access between Linux servers

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.