Answers:
您需要Pageant。
观看使用PuTTY和Pageant进行无密码登录的视频。和/或博客文章Howto:使用PuTTY进行无密码SSH身份验证。
尝试Plink(腻子的一部分)
plink -v youruser@yourhost.com -pw yourpw "some linux command"
我假设您的密钥不受密码保护,并且您得到的不是对密钥密码的请求。
Windows侧的腻子不使用〜/ .ssh,并且腻子没有默认的私钥设置。如果您使用的是cygwin之类的命令行ssh客户端,则可以在家外创建.ssh目录。从腻子中,您需要配置和保存会话。
在腻子配置对话框中,查看连接->数据,然后填写自动登录用户名字段。然后转到连接-> ssh->身份验证,并正确设置您的私钥。然后返回会话对话框,并保存该会话。您也可以根据需要设置主机名。
一旦保存了会话,就可以使用'putty -load“ savedsession”'。
您所需要的只是跨平台ssh
命令行工具ssh-keygen
&ssh-copy-id
。Windows的git包括它们。
从git安装的bash
shell中执行以下操作:
#By default this puts keyfile pair in ~/.ssh/id_rsa & ~/.ssh/id_rsa.pub :
ssh-keygen.exe -t rsa -b 2048
ssh-copy-id -i ~/.ssh/id_rsa.pub $remoteuser@$remotehost
# These two chmod lines are needed on unix platforms, probably not on Windows.
# typically ssh refuses to use a private key file
# if it is less-well protected than this:
chmod 700 ~/.ssh
chmod 640 ~/.ssh/id_rsa
或在PowerShell中运行以下脚本:
Param(
[Parameter()][string]$keyfile="id_rsa",
[Parameter()][string]$remotehost,
[Parameter()][string]$remoteuser
)
write-host "# ---------------------------------------------------------------------------------#"
write-host "# Create an RSA public/private key pair, and copy the public key to remote server #"
write-host "# #"
write-host "# /superuser/96051 #"
write-host "# ssh-from-windows-to-linux-without-entering-a-password/1194805#1194805 #"
write-host "# #"
write-host "# ---------------------------------------------------------------------------------#"
write-host "Keyfile pair will be saved at : ~/.ssh/$keyfile, ~/.ssh/$keyfile.pub"
write-host "And copied to $remoteuser@$remotehost"
write-host ""
write-host "You will need a password for the copy operation."
write-host ""
if( -not $(ls ~/.ssh) ) { mkdir ~/.ssh }
$sshdir=$(get-item ~/.ssh/).Fullname
#By default this puts keyfile pair in ~/.ssh/id_rsa & ~/.ssh/id_rsa.pub :
ssh-keygen.exe -t rsa -b 2048 -f "$sshdir$keyfile"
# ssh-copy-id somehow didn't work in Powershell so I called it via bash
bash -c "ssh-copy-id -i ~/.ssh/$keyfile.pub $remoteuser@$remotehost"
# I'm not sure if these two chmod lines work on windows but
# typically ssh refuses to use a private key file
# if it is less-well protected than this:
chmod.exe 700 $sshdir
chmod.exe 640 "$sshdir$keyfile"
在此之后,无密码登录应同时适用于ssh
和scp
。