Remotely connect to the server through a key on OpenBSD
Source: Internet
Author: User
OpenBSD uses a key to remotely connect to the server-Linux Enterprise Application-Linux server application information. The following is a detailed description. After OpenBSD4.1 is installed, the RSA key and password are used for remote logon over SSH by default.
First, log on to openbsd Using ssh as the root user name. Run again
Ssh-keygen
Then it will ask you if the generated private key is saved in the/root/. ssh/id_rsa file by default.
Press enter to confirm. Then it asks if you want to enter the RSA key protection password. You can enter the protection password,
You can also press enter without entering the password. At last, the Public Key is generated and stored in/root/. ssh/id_rsa.pub.
The fingerprint string of the key is displayed. The program ends.
Cd/root/. ssh
Ls
Two new files are displayed. id_rsa is the private key and cannot be publicly obtained by others. id_rsa.pub is
Public key, which is placed on the server. Because the public key must be in the. ssh directory under the user's home root directory
The authorized_keys file name in. So we need to change the file name.
Mv id_rsa authorized_keys
Use winscp to download id_rsa. Delete the id_rsa file on the server.
Use the Conversions function of PUTTYGEN. EXE to import id_rsa, and then click Save private key
Convert the Private Key to the ppk file format of putty.
Log on to the server
Vi/etc/ssh/ssh_config
Delete the # sign starting with the following three rows.
# RSAAuthentication yes
# PubkeyAuthentication yes
# AuthorizedKeysFile. ssh/authorized_keys
Restart the server.
Run putty, click SSH-> Auth-> Click Browse, and select the ppk file.
Enter the Server IP address in the Session. Connect to the server and enter
Enter the root key to log on as the root user.
To be more secure, do not log on with the user name and password on ssh.
Vi/etc/ssh/sshd_conf
Set
# PasswordAuthentication yes
Modify
PasswordAuthentication no
Save and restart the server.
Ps: I don't know why. I uploaded the RSA public key generated by PUTTYGEN. EXE to openbsd on windows.
Cannot be used. Only RSA keys generated by openbsd can be used.
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.