-2

I am trying to connect to my linux server using the following:

ssh-keygen -t rsa

I then do:

cat ~/.ssh/id_rsa.pub | ssh myusername@myserver_ip 'cat >> .ssh/authorized_keys'

I then go to my remote server and see that a "authorized_keys" file has been created. However when i try doing, "ssh myusername@myserver_ip", it is still prompting me for a password?

Why???

jini
  • 259
  • 6
  • 16

3 Answers3

1

Verify the ownership and permissions on your ~/.ssh directory and its contents:

$ sudo chown -R <user> ~/.ssh
$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/*
EEAA
  • 108,414
  • 18
  • 172
  • 242
1

You may need to check the sshd_config to ensure that these are enabled:

RSAAuthentication yes
PubkeyAuthentication yes

Once those are set to 'yes' then you will need to restart ssh.

1

Ok First of all make sure you have this options enabled in your /etc/ssh/sshd_config

    RSAAuthentication yes
    PubKeyAuthentication yes
    AuthorizedKeysFlle %h/.ssh/authorized_keys

Second, in order to copy the key from ServerA(where you generated the key) to ServerB(where you want to log in) use the following command:

    ssh-copy-id your_username@your_serverB_Ip

If by any chance ServerA doesnt have ssh-copy-id command, in ServerA copy the first line of your key WITHOUT the last 2 characters, then paste it in the ServerB Authorized_Keys file. After that type yourself the missing characters from the line you just copied and the first one from line 2, this will prevent adding a "new line" between the first and second line of the key while pasting it from ServerA to ServerB. Repeat with the 3rd line

Rhyuk
  • 379
  • 2
  • 7
  • 15