A system administrator may manage multiple servers at the same time, which may be placed in different places. It is obviously not the best way to manage them by accessing them one by one. Remote control should be the most effective method. The most common application for remote access is SSH (what? Are you still using telnet ?.... $ % @ % & W @ $ ##).
Configure SSH password-less logon in CentOS
Implement SSH password-less authentication login in Linux
How to configure SSH for Ubuntu and CentOS to enable password-less Login
What is SSH
SSH (Secure Shell) is an encrypted network protocol. Data Using this protocol is encrypted. If Data leaks during transmission, no one can read useful information. To use SSH, the target machine should install the SSH server application, because SSH is based on the customer-service mode. When you want to connect remotely to the host securely, the intermediate network (such as the Internet) is not secure. SSH is usually used in this case.
Install SSH
By default, SSH is installed in Linux. If it happens that your machine is not installed? There are no Linux servers without ssh, but you should remember to upgrade your ssh server). We can install it manually. The simplest way is to use the Linux package manager.
Debian/Ubuntu-based systems: Install ssh-client
- $ Sudo apt-get install openssh-client
Install ssh-server
- $ Sudo apt-get install openssh-server
RedHat/CentOS-based systems:
- # Yum install openssh-server openssh-clients
Once SSH is installed, We can enter ssh in the terminal to check whether the installation is normal.
Use SSH
Provides many available options. This article will introduce some frequently used options in daily operations.
1. Run SSH with no option Parameter
Generally, SSH is used without adding any option parameter. Just enter "ssh ". The following is an example:
- $ Ssh 192.168.0.103
When you connect to the target host for the first time, ssh will allow you to confirm the authenticity of the target host. If you answer NO, SSH will not continue to connect. Only when you answer Yes will you continue, will prompt you ).
The next time you log on to the host again, no confirmation message is prompted for SSH. By default, the real verification information of this host is saved in the/home/user/. ssh file of each user.
2. Specify the Login User
By default, ssh attempts to connect with the current user as the user name. In the preceding command, ssh will try to log on to the server using the username pungki, because pungki is using the ssh client software on the client.
What if there are no pungki users on the target host? In this case, you must provide a user name that exists on the target host. You must specify the user name from the beginning. You can use the-l option parameter.
- $ Ssh-l leni 192.168.0.103
You can also enter:
- $ Ssh leni@192.168.0.0103.
3. Specify the port
The default port number for SSH is 22. In most modern Linux systems, port 22 is open. If you run the ssh program without specifying the port number, it directly sends the request through port 22.
Some system administrators will change the default port number of SSH. Let's try. The current port number is 1234. to connect to the host, use**-P* Option, followed by the SSH port number.
- $ Ssh 192.168.0.103-p 1234
To change the port number, modify the/etc/ssh/ssh_config file and find this line:
- Port22
Replace it with another port number, such as port 1234 in the preceding example, and then restart the SSH service.
4. compress all data requests
With this option, all data sent or received through SSH will be compressed and encrypted. To use the SSH compression function, use the-C option.
- $ Ssh-C 192.168.0.103
This option is very useful if your network connection speed is slow, such as using modem to access the Internet. But if you are using a LAN or other more advanced network, compression will reduce your transmission speed. You can use the-o option plus the compression level parameter to control the compression level, but this option only works under the SSH-1.
5. Specify an encryption algorithm
SSH provides some available encryption algorithms. You can go */Etc/ssh/ssh_config or ~ /. Ssh/config *File (if any ).
For example, if you want to use the blowfish algorithm to encrypt your SSH session, you only need to add this line to your/etc/ssh/ssh_config or ~ The/. ssh/config file can be:
- Cipher blowfish
By default, SSH uses the 3des algorithm.
For more details, please continue to read the highlights on the next page: