putty中设置ssh无密码登陆

 

经过过少次的困惑哦,终于明白了: 
public key 要放到ssh server所在的机器的用户下的~/.ssh/authorized_keys中,且此文件的权限必须为700 。

private key 是ssh client访问的时候需要的ppk文件。

  

转自:

http://hostingrails.com/HowTo-SSH-SCP-without-a-password

http://technitip.net/putty-ssh-login-without-password-prompt

  

Windows 上 SSH

Your desktop is running with Windows and you often need to connect remote servers using SSH then you will already know PuTTY. You will also know that it’s getting frustrating to enter the passoword every time. There is a simple way to login to remote machines using RSA/DAS keys.

What is needed?

First of all you will need to download the PuTTY.exe. And to generate the keys on your Windows desktop you’ll need to download  PuTTYgen.exe as well.

Key Generation

Start PuTTYgen.exe after download and press the Generate button. Now follow the instruction and move the mouse cursor over the desired area. I’ve used the default parameter [x] SSH-2 RSA with a key length of 1024 bits.

I leave the Key passphrase empty because I don’t want to enter any passwords during login.

To have the key later available for other servers use the “Save public key” and “Save private key” button. My private key is saved as haifisch.ppk and my public key as haifisch. By the way, haifisch is German and means shark.

Now mark the generated public key, copy it to the clip board and paste it into ~/.ssh/authorized_keys file on the remote server of the user you want to login as.

 

PuTTY Configuration

Keys have been generated and stored on the remote server, therefore PuTTYgen can be closed now and the PuTTY.exe is needed now.

In PuTTY under the item “Session” enter the host name of the remote server and connection type SSH. Next choose “Connection/Data” and enter the remote user name. Also the previously defined private key is needed, it is given in “Connection/SSH/Auth” using the “Browse” button. In my case it’s haifisch.ppk.

When all settings are done go back to “Session”, enter a name for this session and press “Save”.

That’s it. Try it by double clicking on the saved session.

Login via Desktop Icon

If you want to have a desktop icon which opens putty and logs into a remote server generate a file e.g. www.myserver.com.bat with the content:

start C:\temp\putty\putty.exe -load "Session Name in PuTTY"

Now generate a link to this batch file on your desktop and login in by double clicking.

 

 

完!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值