First, there are two different paths. you can use OpenSSH on the Ubuntu Server to generate a pair of Public and Private keys, or use Putty on Windows. there is no difference in nature. PublicKey is put on the server, and Private key is put on the client. the following assumption is that Putty is directly used for generation:
First, there are two different paths. you can use OpenSSH on the Ubuntu Server to generate a pair of Public and Private keys, or use Putty on Windows. there is no difference in nature. The Public Key is put on the server, and the Private key is put on the client. the following assumes that Putty is directly used for generation:
Put the Public uploaded server in the user's home directory/home/xxx/. ssh, and then convert the format.
Ssh-keygen-I-f keyfile. pub> newkeyfile. pub
Cat newkeyfile. pub> authorized_keys
Cat is used mainly to add it at the end of the file, because authorized_keys can contain multiple Public keys. if it is the first one, you can directly generate authorized_keys using mv.
Chmod 700. ssh
Chmod 600 authorized_keys
If you want to use the key generated by putty on linux or mac, you need to convert putgen to openssh format, and then you can log on with ssh xxx@example.com-I privatekey. ssh