Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a problem with public and private key authentication. I do this steps and then, public-key based doesn't work. 1- generate a pair of private and public key (RSA) using the following command:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/rc_ss/.ssh/id_rsa): 
Created directory '/home/rc_ss/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/rc_ss/.ssh/id_rsa.
Your public key has been saved in /home/rc_ss/.ssh/id_rsa.pub.
The key fingerprint is:
ac:fd:d1:2e:e5:1e:db:87:98:77:9e:14:62:db:97:f0 rc_ss@rc_ss-network
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|                 |
|       .         |
|        S    + . |
|       o   .o * o|
|      . . .oo+ E.|
|         ..o+++ =|
|          .o+..=.|
+-----------------+

2- copy it through network with ssh-copy-id as follows

rc_ss@rc_ss-network:~$ ssh-copy-id -i .ssh/id_rsa.pub root@192.168.2.100
The authenticity of host '192.168.2.100 (192.168.2.100)' can't be established.
ECDSA key fingerprint is 33:67:e0:02:b1:10:46:76:78:6b:1f:e2:55:9b:6a:a8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.2.100' (ECDSA) to the list of known hosts.
root@192.168.2.100's password: 
Now try logging into the machine, with "ssh 'root@192.168.2.100'", and check in:

  ~/.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

3- then, I want to get connected to server ssh without password, and deal with following:

rc_ss@rc_ss-network:~$ ssh root@192.168.2.100
root@192.168.2.100's password: 

Which means the password required yet. Can anybody help me? Appreciate it.

share|improve this question
    
If you run a cat /root/.ssh/authorized_keys on the target machine, do you see the public key from the original machine? –  Ross Jun 6 at 19:47
    
Yes, I can see that. –  Rc Ss Jun 6 at 19:48
    
Can you confirm that the permissions on /root/.ssh/authorized_keys are rwx------, and that the ssh server's sshd_config specifies PubkeyAuthentication yes? –  rocketman10404 Jun 6 at 19:51
    
the permission of /root/.ssh/authorized_keys is : -rw------- and that sshd_config is :PubkeyAuthentication yes –  Rc Ss Jun 6 at 19:54
    
Oh sorry, my permission statement was wrong. What you specified is correct. –  rocketman10404 Jun 6 at 20:00
show 3 more comments

1 Answer 1

Assuming that the public key was correctly copied to the target server, you'll need to make sure that the SSH daemon supports passwordless login. This configuration is set in the /etc/ssh/sshd_config file, and you need to make sure the following values are set:

PermitRootLogin yes
RSAAuthentication yes
PubkeyAuthentication yes

If those values are not set, you will need to set them and then restart SSH with sudo service ssh restart in a terminal.

share|improve this answer
    
These settings are correct in both of the server and client. But Public Key Authentication doesn't work yet. Thanks for your answer. –  Rc Ss Jun 6 at 19:59
    
Do you have any other idea? Appreciate it. –  Rc Ss Jun 6 at 20:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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