1

我正在尝试使用公钥和私钥机制将无密码ssh连接用于rackspace中的cloudserver(运行redhat)。在机架空间云中使用密钥身份验证的无密码ssh失败:请求输入密码

我的命令(服务器):

  1. 的adduser -g根
  2. 的mkdir /home//.ssh
  3. 复制我的公钥/home//.ssh/authorized_keys
  4. 搭配chmod 700 /home//.ssh
  5. 搭配chmod 600 /home//.ssh/authorized_keys

在在Rackspace公司云服务器的配置文件:

  1. RSA验证是
  2. Pubkey验证是
  3. #AuthorizedKeysFile的.ssh/authorized_keys中

当我尝试做 “的ssh -i my_priv_key @server_ip” ,它会失败并要求我输入@server_ip的密码。

当我将以下行添加到我的服务器上的sshd_config时,它说Permission denied(publickey,gssapi-keyex,gssapi-with-mic)。

满足用户 的PasswordAuthentication没有

我一直在努力的最后几个小时,但我无法弄清楚。所以任何想法如何解决这个问题。

回答

0

您是否检查了服务器上的时间设置权限&。 另外,你有没有从帖子中删除用户名。

尝试使用-v选项执行ssh。这将为调试提供更多输出。

+0

也确保你有正确的selinux上下文,以防你使用它。运行命令: - restorecon -r -vv /home/user/.ssh – bsrawat

+0

我检查了权限。他们很好。我还将我的公钥添加到服务器的根目录的ssh目录中。现在,当我尝试使用-i和私钥ssh时,它连接时没有任何密码提示...所以任何想法如何解决这个正常用户..? – Pattu

+0

你可以在这里粘贴ssh -v user @ server – bsrawat

0

我发现在远程服务器上设置SSH密钥的最简单方法是使用ssh-copy-id命令。

http://linux.die.net/man/1/ssh-copy-id

+0

的输出我使用ssh-copy-id将ssh密钥复制到root的ssh目录,它工作正常,但是当我通过“ssh-copy(服务器) -id user @ IP“,即使用户没有,也要求用户输入密码。 – Pattu

1

这并不完全回答你的问题,但我想告诉你another way使用Rackspace的API把你的SSH密钥服务器上,自动化。如果,例如,您正在使用pyrax

API Key

一旦服务器:

import pyrax 
import os 

pyrax.set_setting("identity_type", "rackspace") 
pyrax.set_setting("username", USER_NAME) # User name 
pyrax.set_setting("api_key", API_KEY) # Located in the control panel in settings 

# Could also use a credential file 
# pyrax.set_credential_file(os.path.expanduser("~/.rackspace_cloud_credentials")) 

# Put your SSH key on the Rackspace cloud 
pubkey = open("my_priv_key").read() 
cs.keypairs.create("testkey", pubkey) 

# For demo purposes, grab a sample image, server type (flavor in OpenStack parlance) 
flavor_512 = [flavor for flavor in cs.flavors.list() if flavor.ram == 512][0] 
ubu_image = [img for img in cs.images.list() if "Ubuntu 12.04" in img.name][0] 

# Now we can create the server and assign an ssh key 
server = cs.servers.create("ubbie", ubu_image.id, flavor_512.id, 
     key_name="testkey") 

你的API密钥位于设置和云控制面板中的联系人,安全问题下方建成后,你应该能够使用指定的键来获取IP地址

server = cs.servers.get(server.id) 
ip = server.accessIPv4 

然后简单的ssh作为根。

ssh -i my_priv_key [email protected]<ip> 

如果Python不是您的首选语言,还有其他选项。如果这是您的事情,您也可以直接要求/使用卷曲,因为这是Rackspace APIOpenStack/nova proper的一部分。

相关问题