暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

SSH authentication with public key

勤劳的存锋 2019-05-03
342

To access unix ssh server through publickey authentication

 

1 client SecureCRT

  1. 1  generate the public key throughsecureCRT

1.1.1         generate the public and private key

tools à create Public keys

Select RSA key type

Leave the passphrase empty or set it, it is up to you

Set the key length to 1024 or 2048

Creating the key


Create key in openssh format

Rememberthe public and private key are in folder :\users\admin\documents

         Publickey Identity.pub, private key Identify

  1. 1.2         check the session globalconfiguration

options à global session

  1. 1.3         Upload the public key throughscp/ftp/sftp etc to directory $HOME/.ssh

  2. 1.4         Add the public toauthorized_keys

cat Identity.pub >> authorized_keys

  1. 1.5         ssh to server

 

  1. 2  generate the public key at server side

  2. 2.1         generate the key

cd $HOME/.ssh

ssh-keygen

you will see 2 files, id_rsa and id_rsa.pub

  1. 2.2         add the public key toauthorized_key

cat id_rsa.pub >> ~/.ssh/authorized_keys

 

  1. 2.3         download the private key toclient side /users/admin

  2. 2.4         set the global key todownloaded one

options à global options


 

 

2        From linux to linux

  1. 1  generate the key at the client

ssh-keygen

  1. 2  copy the public key to server

ssh-copy-id username@server

  1. 3  ssh from client to server

check the server file ~/.ssh/authorized_key

 

3        Client putty

  1. 1  Generate the key with putty

  2. 1.1         Run the puttygen

The quick you move the mouse, the sooner the key generated

Copy the public key and append to authorized_keys

Save the private key

 

  1. 1.2         Start the pageant

Right click the icon of pageant and select the add key

Add the save the private key

  1. 1.3         start putty

Input the server ip and user name and click open

  1. 2  Generate the key at the server

Download the private key generate by server

PUTTY private key format is different with other, use puttygento convert the format

Open puttygen and load the key downloaded from the server

Save the private key

Right click the pageant and select add key

 

Open putty and connect the server


文章转载自勤劳的存锋,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论