Cygwin下使用公钥登录SSH
为了直接使用公钥登录SSH,而不使用密码登录Cygwin,费了老大劲,很长时间以来一直没有成功。此前,一直是按照网络上流传的方法,主要是生成key,然后设置到 authorized_keys中。遵照官方的命令,修改sshd_config, ssh_config, 但是一直没有奏效(不过遵照这些方法,在Ubuntu等系统上配置成功)。
昨天偶然在这个页面上看到 ssh-user-config 命令,试了试,就成功了!各位设置不成功的同学,考虑使用下这个命令,然后一路回车确认即可。
另一篇重要的参考文章:这里。
顺便记录下在探索 SSH使用公钥登录过程中学到的几个sshd相关的命令:
# debug more information ssh -vvv localhost #start services net start sshd #or cygrunsrv --start sshd #login command for user name that has space ssh Mickey\ mouse@127.0.0.1 #copy publickey to remote host king@king:~$ cat .ssh/id_dsa.pub | ssh master "cat - >> ~/.ssh/authorized_keys" #copy publickey from remote host king@king:~$ ssh master "cat .ssh/id_dsa.pub" | cat - >> ~/.ssh/authorized_keys"
在某些情况下,必须使用代理登录SSH服务器。connect.c is the simple relaying command to make network connection via SOCKS and https proxy. It is mainly intended to be used as proxy command of OpenSSH. You can make SSH session beyond the firewall with this command.
在Windows下,只需要下载connect.exe到c:/windows,然后在 ~/.ssh/config中添加如下配置:
ProxyCommand connect -S x.x.x.x:x %h %p
connect.c 还支持 https 代理,真不赖。
Related posts:
最近评论