2011-12-02 37 views
6

Tôi đang cố gắng thiết lập ghép nối khóa SSH với dreamhost và máy cục bộ của mình. Tôi đang sử dụng git bash làm thiết bị đầu cuối của tôi (sử dụng mingw32)Khóa SSH trên dreamhost

Tôi có thể ssh [email protected] và tôi được yêu cầu nhập mật khẩu của mình. Tôi đã tạo khóa RSA trên cả máy chủ dreamhost cục bộ và máy chủ của mình. Dưới đây là các bước tôi đi trên thiết bị đầu cuối git của tôi:

$ scp ~/.ssh/id_rsa.pub [email protected]:~/ 

$ ssh [email protected] 
[email protected]'s password: ***** 
$ (ls shows my local's id_rsa.pub in the ~ directory) 
$ cd ~/.ssh 
$ ls 
id_rsa id_rsa.pub key_backup 
$ cat ./id_rsa.pub >> authorized_keys (i know I could have just copied) 
$ ls 
authorized_keys id_rsa id_rsa.pub key_backup 

vi authorized_keys shows my local's pubkey 

$ chmod go-w ~ 
$ chmod 700 ~/.ssh 
$ chmod 600 ~/.ssh/authorized_keys 

sau đó tôi thoát khỏi kết nối ssh và gõ ssh [email protected] vào vỏ địa phương của tôi

và tôi đang yêu cầu một mật khẩu ... . tôi làm gì sai ở đây?

tôi có cần thiết lập ssh-agent không? khi tôi làm, và thử ssh-add tôi nhận được 'không thể mở một kết nối với đại lý xác thực của bạn'

Cảm ơn bạn đã giúp đỡ!

EDIT: Đây là một bãi chứa của ssh -v

$ ssh -v [email protected] 
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007 
debug1: Connecting to mysharedserver.com [xxx.xxx.xxx.xx] port 22. 
debug1: Connection established. 
debug1: identity file /c/Users/User/.ssh/identity type -1 
debug1: identity file /c/Users/User/.ssh/id_rsa type 1 
debug1: identity file /c/Users/User/.ssh/id_dsa type -1 
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debia 
n-5 
debug1: match: OpenSSH_5.1p1 Debian-5 pat OpenSSH* 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_4.6 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client aes128-cbc hmac-md5 none 
debug1: kex: client->server aes128-cbc hmac-md5 none 
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP 
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY 
debug1: Host 'mysharedserver.com' is known and matches the RSA host key. 
debug1: Found key in /c/Users/User/.ssh/known_hosts:2 
debug1: ssh_rsa_verify: signature correct 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: SSH2_MSG_SERVICE_REQUEST sent 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey,password 
debug1: Next authentication method: publickey 
debug1: Trying private key: /c/Users/User/.ssh/identity 
debug1: Offering public key: /c/Users/User/.ssh/id_rsa 
debug1: Authentications that can continue: publickey,password 
debug1: Trying private key: /c/Users/User/.ssh/id_dsa 
debug1: Next authentication method: password 
[email protected]'s password: 
+0

P.S. khóa RSA mà tôi tạo được tạo bằng mật khẩu và không được để trống. Tôi được khuyên rằng điều này sẽ làm việc với một mật khẩu trống nhưng không phải là một mật khẩu tạo ra chìa khóa. Bất kỳ ý tưởng nào về lý do tại sao điều này có thể là vấn đề, nếu thực sự nó là? –

Trả lời

8

Tôi đã có vấn đề tương tự gần đây. Kiểm tra quyền truy cập vào máy chủ:

  • ~/(toàn bộ thư mục home) 755 hoặc thấp hơn cho nhóm & người khác - đây là nguyên nhân của vấn đề này đối với tôi tôi có 765
  • ~/.ssh 700
  • ~/.ssh/authorized_keys 600

cập nhật:

cũng có thể vấn đề với encryptfs, chi tiết ở đây: https://serverfault.com/questions/310827/ssh-prompts-for-password-even-though-private-keys-are-available-presented-to-se/310829#310829

+0

Cảm ơn, điều này đã sửa nó. – Alper

Các vấn đề liên quan