Ubuntu configures SSH Server to allow users to log in from outside
The teaching passed the test on Ubuntu 20.04.
When I just installed Ubuntu Desktop, I found that I could not log in from the outside with SSH. The main reason was that SSH Server was not installed and configured.
installation
Inspection kit:
dpkg -l | grep ssh
Sure enough, there is no SSH Server.
installation:
sudo apt-get install openssh-server
Check again, add -server and sft-server, there are!
Configuration
To configure SSH Server so that he can log in using SSH Key from Windows. Many teachings here are very confusing, mainly because the key configuration is very abstract to many people. Remember, the logged-in end is only Public Key is required, and Private Key is required only at the end that requires login.
Here we assume that the Private Key has been generated with Putty and saved as a .ppk file name. First open the Private Key with PuTTYgen, and then Save the public key. The extension is whatever you want. You don't need to use it. In fact, the key is just a string that looks garbled.
Copy the Public Key to Ubuntu, and then install putty-tools:
sudo aptitude install putty-tools
Import the converted Public Key into authorized_keys, the braces are not included in the command, remember to remove:
puttygen {Public Key} -O public-openssh >> ~/.ssh/authorized_keys
Modify sshd_config:
sudo vi /etc/ssh/sshd_config
Configuration settings:
PubkeyAuthentication yes
Finally, remember to restart the ssh service:
sudo systemctl restart ssh
After completing the above, you can use some Windows SSH/SFTP Client software to configure the Private Key and log in.
Comments
Post a Comment