When more than three machines are combined, the management will be in disorder. therefore, You need to log on to the certificate to manage the server cluster. the master node can be directly logged on to the data node through ssh. the control node can directly log on to the controlled node. to use the concept of C/S, the client needs to install openssh-client, and the server needs to install openssh-server. in fact, we will soon find out which services and customers are there. therefore, you can check whether openssh is installed on all machines.
When more than three machines are combined, the management will be in disorder. therefore, You need to log on to the certificate to manage the server cluster. the master node can be directly logged on to the data node through ssh. the control node can directly log on to the controlled node.
To use the concept of C/S, the client needs to install openssh-client, and the server needs to install openssh-server. in fact, we will soon find out which services and customers are there. therefore, openssh is installed on all machines. You can check whether they are installed:
$ Apt-cache policy openssh-client
$ Apt-cache policy openssh-server
You can also install them directly:
$ Sudo apt-get install openssh-client
$ Sudo apt-get install openssh-server
In addition, we need to install the ssh software sshpass without interactive password login, so that we can write the password to the command line, so that the script installation process without manual intervention is possible.
$ Sudo apt-get install sshpass
After the installation is complete, you can access another ubuntuB on any UbuntuA.
$ Sshpass-p abc123 ssh car @ ubuntuB
Where:
The car is the username of ubuntuB. We assume that the user names A and B are all car
Abc123 is the car Password
By using this technology, you can easily log on to each machine without having to enter the password interactively. However, this is definitely not secure. This is just a script in the installation phase.
Ssh certificate logon method:
Suppose we want to access another ubuntuB in ubuntuA, so we need to generate A Public Key key pair on. then copy the public key to B and add the public key to the current user's. in ssh/authorized_keys. then you can log on to B directly on.
1) generate A public key pair on
$ Ssh-keygen-t rsa-p'-f ~ /. Ssh/id_rsa
We can see that
/Home/car/. ssh/id_rsa
/Home/car/. ssh/id_rsa.pub
2 files.
2) Copy id_rsa.pub to machine B.
$ Scp./. ssh/id_rsa.pub car @ ubuntuB :~ /
UbuntuB is the IP address or the machine name, but you need to add one in/etc/hosts of:
192.168.63.101 ubuntuB
3) log on to B
$ Sshpass-p abc123 ssh car @ ubuntuB
4) add id_rsa.pub to B's ~ /. Ssh/authorized_keys
$ Cat./id_rsa.pub./. ssh/authorized_keys
$ Exit
5) log on to B again in.
$ Ssh car @ ubuntuB
The password is no longer needed.
6) Suppose you still have C, D, E, F... you also need to log on to B on the machine, as long as you copy the id_rsa private key file generated on A to the corresponding machine.
Remember, this is an insecure operation. Generally, you need to set a password for the private key file id_rsa. It is not covered in this article.
Note: although this document is case-insensitive, you should use only lowercase letters at any time.