2

I am trying to install git on a remote server and these are the details of that pc

IP 192.168.1.7 
Ubuntu version 12.04 32 bit 

and I have install both openssh and the status of the ssh is this

ssh start/running, process 756

And I am trying to ssh to that pc from local pc and these are the details of my local

IP 192.168.1.4
Ubuntu version 12.04 64 bit

I have ping to the 192.168.1.7

rashendra@rashendra:~$ ping 192.168.1.7
PING 192.168.1.7 (192.168.1.7) 56(84) bytes of data.
64 bytes from 192.168.1.7: icmp_req=1 ttl=64 time=0.918 ms
64 bytes from 192.168.1.7: icmp_req=2 ttl=64 time=1.02 ms
64 bytes from 192.168.1.7: icmp_req=3 ttl=64 time=3.78 ms
^C
--- 192.168.1.7 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.918/1.908/3.782/1.326 ms

which means I can connect to that pc , and the connectivity is alive.

I have generate the rsa public/private key which are stored in the /home/rashendra/.ssh

rashendra@rashendra:~/.ssh$ ll

total 20
drwxrwxrwx  2 rashendra rashendra 4096 Nov 17 11:37 ./
drwxr-xr-x 47 rashendra rashendra 4096 Nov 17 08:35 ../
-rw-------  1 rashendra rashendra 1679 Nov 17 10:57 id_rsa
-rwxrwxrwx  1 rashendra rashendra  401 Nov 17 10:57 id_rsa.pub*
-rw-r--r--  1 rashendra rashendra  444 Nov 17 11:45 known_hosts

After that I copied the content of the id_rsa.pub to the authorized_keys in the .ssh of the remote pc

cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys

This is the .ssh of the git user which I created.
So, now I am trying to connect to the remote pc using

ssh git@192.168.1.7 

yet gives the following error:

rashendra@rashendra:~/.ssh$ ssh git@192.168.1.7

Permission denied (publickey).

Please advice how to resolve. As I need to install git on this remote server and maintain further.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250

1 Answers1

1

Check your permissions:

  • on the client side (chmod 644 ~/.ssh/id_rsa.pub)
  • on the server side

    chmod 700 /home/git/.ssh
    chmod 600 /home/git/.ssh/authorized_keys
    

Then, if it is still not working, check the output of:

  • on the client side, a ssh -Tvvv git@192.168.1.7
  • on the server side, a debug ssh daemon session (/usr/sbin/sshd -d): see this answer.
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • hi, This is what I got after running /usr/sbin/sshd -d debug1: sshd version OpenSSH_5.9p1 Debian-5ubuntu1.4 debug1: could not open key file '/etc/ssh/ssh_host_rsa_key': Permission denied Could not load host key: /etc/ssh/ssh_host_rsa_key debug1: could not open key file '/etc/ssh/ssh_host_dsa_key': Permission denied Could not load host key: /etc/ssh/ssh_host_dsa_key debug1: could not open key file '/etc/ssh/ssh_host_ecdsa_key': Permission denied Could not load host key: /etc/ssh/ssh_host_ecdsa_key debug1: setgroups() failed: Operation not permitted debug1: rexec_argv[0]='/usr/sbin/sshd' – Rashendra - Rashen Nov 17 '14 at 09:21
  • debug1: rexec_argv[1]='-d' Set /proc/self/oom_score_adj from 0 to -1000 debug1: Bind to port 22 on 0.0.0.0. Bind to port 22 on 0.0.0.0 failed: Permission denied. debug1: Bind to port 22 on ::. Bind to port 22 on :: failed: Permission denied. Cannot bind any address. – Rashendra - Rashen Nov 17 '14 at 09:23
  • how ever I did the vice versa, creating a rsa keypair in the remote server and append the public key to the authorized_keys in my local machine .. Guess what I was able to open ssh terminal as well as install git on my local pc( 192.168.1.4)... only difference which I am seeing here is that my ubuntu is 64bit thr remote pc is 32 – Rashendra - Rashen Nov 17 '14 at 09:28
  • @Rashendra-Rashen the sshd must be run as root – VonC Nov 17 '14 at 09:30
  • yes I did , yet it did not change the out come... I still cant ssh from my local pc to the remote server. – Rashendra - Rashen Nov 17 '14 at 10:49