Ubuntu cluster SSH configuration for remote login

Source: Internet
Author: User

Ubuntu does not have the default SSH service installed, if you link ubuntu via SSH, you need to manually install Ssh-server on each host in the cluster. To determine whether to install the SSH service, you can pass the command: SSH localhost test, if it appears

Ssh:connect to host localhost Port 22:connection refused is not yet installed and can be installed via apt, with the following command:

sudo apt-get install Openssh-server

The system will be installed automatically, after the installation is complete, start the service first:

Sudo/etc/init.d/ssh start

After you start, you can see if the service starts correctly with the following command

Ps-e|grep SSH

6212? XX: +sshd

Ps-e|grep ssh 6212? 00:00:00 sshd

The above indicates the start OK. Note that the default SSH port is 22, you can change the port, stop before changing,

And then start is ready.

Cluster on each virtual machine, use ssh-keygen-t RSA all the way to press ENTER on the line. The main is to set the SSH key and key storage path. The path is ~/.ssh

Open ~/.ssh has the following files

Id_rsa, private key

Id_rsa.pub, Public key

Here is the key point, (We want to do SSH authentication.) Before you do this, you can search for authentication and encryption differences and their respective processes. )

① put the public key into Authorized_keys on master. Command: sudo cat id_rsa.pub >> Authorized_keys

② the Authorized_keys on master to other Linux ~/.ssh directories.

Command: sudo scp authorized_keys [email protected]:~/.ssh

sudo SCP authorized_keys remote host user name @ remote host name or IP: Store path.

③ Modify Authorized_keys permissions, command: chmod 644 Authorized_keys

To modify a configuration using the command vi/etc/ssh/sshd_config:

Allow Root Login

Vi/etc/ssh/sshd_config

Change the Permitrootlogin value to Yes

Allow login without entering password

Remove the # number in front of permitemptypasswords Yes

Restart Services: Service sshd restart (/etc/initd.d/sshd restart)

④ Test is successful

SSH slave1 Enter the user name password, and then exit, SSH slave1 without password, directly into the system. That means it's a success.

Ubuntu cluster SSH configuration for remote 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.