问题描述
我试图在远程服务器上安装git,这些是该pc的详细信息
cat /tmp/id_rsa.pub>> 〜/ .ssh / authorized_keys
这是 .ssh 我创建的git用户。
所以,现在我试图用
ssh git@192.168.1.7
还有以下错误:
rashendra @ rashendra:〜/ .ssh $ ssh git@192.168.1.7
权限被拒绝(publickey)。
请咨询如何解决。
因为我需要在这个远程服务器上安装git并进一步维护。
解决方案检查:
- ( chmod 644〜/ .ssh / id_rsa.pub )
在
chmod 700 /home/git/.ssh
chmod 600 /home/git/.ssh/authorized_keys
b $ b
- 在客户端, ssh -Tvvv git@192.168.1.7
- 在服务器端,一个调试ssh守护进程会话( / usr / sbin / sshd -d ):参见。
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 bitand I have install both openssh and the status of the ssh is this
ssh start/running, process 756And 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 bitI 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 mswhich 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_hostsAfter 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_keysThis is the .ssh of the git user which I created.
So, now I am trying to connect to the remote pc usingssh git@192.168.1.7yet 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.
解决方案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_keysThen, 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.
这篇关于SSH在远程PC在同一网络 - 权限被拒绝(公钥)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!