diff --git a/sources/tech/20150323 How to enable ssh login without entering password.md b/sources/tech/20150323 How to enable ssh login without entering password.md deleted file mode 100644 index 64449b7228..0000000000 --- a/sources/tech/20150323 How to enable ssh login without entering password.md +++ /dev/null @@ -1,42 +0,0 @@ -[translating by KayGuoWhu] -How to enable ssh login without entering password -================================================================================ -Assume that you are a user "aliceA" on hostA, and wish to ssh to hostB as user "aliceB", without entering her password on hostB. You can follow this guide to **enable ssh login without entering a password**. - -First of all, you need to be logged in as user "aliceA" on hostA. - -Generate a public/private rsa key pair by using ssh-keygen. The generated key pair will be stored in ~/.ssh directory. - - $ ssh-keygen -t rsa - -Then, create ~/.ssh directory on aliceB account at the destination hostB by running the following command. This step can be omitted if there is already .ssh directory at aliceB@hostB. - - $ ssh aliceB@hostB mkdir -p .ssh - -Finally, copy the public key of user "aliceA" on hostA to aliceB@hostB to enable password-less ssh. - - $ cat .ssh/id_rsa.pub | ssh aliceB@hostB 'cat >> .ssh/authorized_keys' - -From this point on, you no longer need to type in password to ssh to aliceB@hostB from aliceA@hostA. - -### Troubleshooting ### - -1. You are still asked for an SSH password even after enabling key authentication. In this case, check for system logs (e.g., /var/log/secure) to see if you see something like the following. - - Authentication refused: bad ownership or modes for file /home/aliceB/.ssh/authorized_keys - -In this case, failure of key authentication is due to the fact that the permission or ownership ~/.ssh/authorized_keys file is not correct. Typically this error can happen if ~/.ssh/authorized_keys is read accessible to anyone but yourself. To fix this problem, change the file permission as follows. - - $ chmod 700 ~/.ssh/authorized_keys - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/how-to-enable-ssh-login-without.html - -作者:[Dan Nanni][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://xmodulo.com/author/nanni \ No newline at end of file diff --git a/translated/tech/20150323 How to enable ssh login without entering password.md b/translated/tech/20150323 How to enable ssh login without entering password.md new file mode 100644 index 0000000000..4f9a4c317d --- /dev/null +++ b/translated/tech/20150323 How to enable ssh login without entering password.md @@ -0,0 +1,41 @@ +如何实现ssh无密码登录 +================================================================================ +假设你是hostA上的一个用户"aliceA",想以用户“aliceB”的身份ssh到hostB上,但又不想输入密码。那么,你可以参考这篇教程实现ssd无密码登录。 + +首先,你需要以用户“aliceA”的身份登录到hostA上。 + +然后,使用ssh-keygen生成一对rsa公私钥,生成的密钥对会存放在~/.ssh目录下。 + + $ ssh-keygen -t rsa + +接下来,使用下面的命令在目标主机hostB上的aliceB用户目录下创建~/.ssh目录。如果在aliceB@hostB上已经存在.ssh目录,这一步会被略过。 + + $ ssh aliceB@hostB mkdir -p .ssh + +最后,将hostA上用户“aliceA”的公钥拷贝到aliceB@hostB上,来实现无密码ssh。 + + $ cat .ssh/id_rsa.pub | ssh aliceB@hostB 'cat >> .ssh/authorized_keys' + +自此以后,从aliceA@hostA上ssh到aliceB@hostB上再也不需要输入密码。 + +### 疑难解答 ### + +1. 即使在密钥认证生效后,你可能仍然需要输入SSH密码。如果遇到这种情况,请检查系统日志(如/var/log/secure)以查看是否出现下面的异常。 + + Authentication refused: bad ownership or modes for file /home/aliceB/.ssh/authorized_keys + +在这种情况下,密钥认证的失败是由于~/.ssh/authorized_keys文件的权限或拥有者不正确。一般情况,如果这个文件对除了你之外的所有用户都可读,就会出现这个错误。用下面的方式改变文件的权限以修正错误。 + + $ chmod 700 ~/.ssh/authorized_keys + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/how-to-enable-ssh-login-without.html + +作者:[Dan Nanni][a] +译者:[KayGuoWhu](https://github.com/KayGuoWhu) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni \ No newline at end of file