0

I generate public/private keys to connecto to server with ssh without write password every time. I'm using:

Client: Debian GNU/Linux 8.2 (jessie) with Kernel 3.16.0-4-amd64 OpenSSH_6.7p1 Debian-5, OpenSSL 1.0.1k 8 Jan 2015

Server: CentOS release 6.6 (Final) with Kernel 2.6.32-504.16.2.el6.x86_64 OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013

I generate the keys following the step suggest on Debian and CentOS webpages.

But when I try to connect to server using ssh -p ## user@server, ssh prompted to enter password still.

I want aclare that when I enter the password I can log in to server, but I want to log in without password.

Anyone have an idea how can solve this issues?

Client

ssh -vvv
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]

Server

ssh -vvv
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-e escape_char] [-F configfile]
           [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-R [bind_address:]port:host:hostport] [-S ctl_path]
           [-W host:port] [-w local_tun[:remote_tun]]
           [user@]hostname [command]

Client

ls -l .ssh/

total 12
-rw------- 1 client client 1766 nov  8 12:51 id_rsa_zeus
-rw-r--r-- 1 client client  395 nov  8 12:51 id_rsa_zeus.pub
-rw-r--r-- 1 client client 3493 ago 19 15:56 known_hosts

ls -Z .ssh/

? id_rsa_zeus  ? id_rsa_zeus.pub  ? known_hosts

Server

ls -l .ssh/

total 4
-rw------- 1 server user 395 nov  8 12:21 authorized_keys

ls -Z .ssh/

-rw------- server user ?                                authorized_keys
  • Please add the output of ssh -vvv to your question. – Bram Nov 10 '15 at 7:08
  • Also add listings of the .ssh dirs (ls -l and ls -Z) on both client and server please. – Bram Nov 10 '15 at 7:15
  • The output of ssh -vvv doesn't really help us. What @Bram meant was to add -vvv to the SSH commands that you're using. e.g., "ssh -vvv -p ## user@server". (You do not need to run this on the server.) – TOOGAM Nov 10 '15 at 7:20
  • a common pitfall is that .ssh dir must be own by user ( server user in yoyr cas) , and be drwx------ (that is chmod 700 .ssh ) – Archemar Nov 10 '15 at 7:33
  • It has the property permission, like explain and CentOS and Debian webpages... ls -la | grep '.ssh' drwx------ 2 server user 4096 nov 8 12:21 .ssh – user2547450 Nov 10 '15 at 7:38
0

Try:

ssh -p 22 -i /full-path-to/privateKeyFileName -l user serverName

If that doesn't work, check the SSH authorization log (e.g., /var/log/authlog for OpenSSH, though OpenSSH portable might vary... try "ls -ltr /var/log/" to identify what log files changed most recently) to see if that provides clues. If the public key is in the right place on the server (in the ~/.ssh/authorized_keys file), the most likely problem is permissions.

Offhand, I'm not sure if -p 0000 is valid. The default is 22 and you can definitely customize that to other numbers from 1-65535.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.