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