ssh access from windows to linux by putty.
# vi /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no
/etc/init.d/sshd restart
Let's take user "jmbkeyes" as an example.
1. linux server install openssl, create .ssh directory in /home/jmbkeyes/, and grant permission.
mkdir .ssh
chmod 755 .ssh
2. use PuTTY Key Generator(PUTTYGEN.EXE) to generate public/private key pair(save the keys as test.pub, test.ppk).
3. use PSCP.EXE in command line
PSCP.EXE test.pub jmbkeyes@10.197.60.104:.ssh
4. in linux command line(go to dir /home/jmbkeyes/.ssh), append pub key to authorized_keys file.
cat test.pub >> authorized_keys
5. modify the public key in the authorized_keys (just copy public from puttygen, and paste to authorized_keys)
normally, the format of pub key generated by PuTTY as below.
---- BEGIN SSH2 PUBLIC KEY ----
Comment: "rsa-key-20130206"
AAAAB3NzaC1yc2EAAAABJQAAAIBcugEsWBNo7PaTlRvkOlq3onz3FmPE221z+TW5
SMYAeLJYfsRgrzkmoIPMRk/rkmYF/s5adzZ2L2YDjUhRz/x++7PhTOCuKF8iRs4G
1Q5L0S7FKef2s34scCjMkttYpPSPMP7qugdQxITuaAH7km+fOps0hPbwCXohK06p
vFxTrQ==
---- END SSH2 PUBLIC KEY ----
But openssh can't correctly authenticate the private key via the pub key for the pub key format error, it will raise error message "Server refused our key". So we need to change the pub key in authorized_keys as below(all in one line).
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIBcugEsWBNo7PaTlRvkOlq3onz3FmPE221z+TW5SMYAeLJYfsRgrzkmoIPMRk/rkmYF/s5adzZ2L2YDjUhRz/x++7PhTOCuKF8iRs4G
1Q5L0S7FKef2s34scCjMkttYpPSPMP7qugdQxITuaAH7km+fOps0hPbwCXohK06pvFxTrQ== jmbkeyes@10.197.60.104
6. then use the PuTTY via private key to connect to linux server
for linux, refer to http://blog.csdn.net/lin_fs/article/details/7309714