Ok, sánh I have tried this quite a few times and I'm sure this is very trivial but: I am trying to lớn SSH via command line on Ubuntu into my VM (Centos6) with an RSA key-pair I created using key-gen.
I have created the key-pair and appended the public key to lớn authorized_keys tệp tin and changed the permissions to lớn 600
. After I SCP'ed the private key to lớn Ubuntu and tried to lớn SSH using it and I always get:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
I have tried this 3x already and no luck. I can ping it but I can't seem to lớn figure out why it's not taking the key I made. Any suggestions?
asked Sep 2, năm ngoái at 22:04
ryekayoryekayo
4,7839 gold badges45 silver badges67 bronze badges
9
Run ssh with verbose mode (add as many -v as you need) and try to lớn find out the reason.
For example
ssh -vvv user@host
You will get a debug output that helps you to lớn find out the reason.
answered Jan 18, năm 2016 at 23:47
2
First generate the key-pair on your Ubuntu machine.
After, copy the contents of the generated .pub
tệp tin in your ssh thư mục (~/.ssh/id_rsa
) and paste it to lớn the username/.ssh/id_rsaauthorized_keys
tệp tin, on a new line, on your CentOS for the specific user you are logging in with.
Mathieu
2,7311 gold badge21 silver badges25 bronze badges
answered Jan 18, năm 2016 at 20:58
I just had the same problem on ClearOS 7.2 while trying to lớn login through SSH using RSA from OSX.
Turns out I had to lớn add the filename of my private key (the one that resides on the client system, OSX in this case) on the client system to lớn the /etc/ssh/ssh_config tệp tin (this is the ssh client config tệp tin on the client machine). Otherwise it just wouldn't look in that tệp tin eventhough it starts with id_rsa.
The line added was:
IdentityFile ~/.ssh/id_rsa.somecomputer
"somecomputer" is whatever the rest of the filename you might have is.
answered May 14, năm 2016 at 5:39
I had the same problem, I solved it lượt thích this:
On the ssh server, I uncommented, and put at yes the following values in /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
And then:
sudo service sshd restart
answered Dec 5, năm 2016 at 11:07
mattmatt
2292 silver badges4 bronze badges
You can execute tail -f /var/log/auth.log
command if it exists on the server and try login again, you could see the reason for the failure which is available in the log. If not, kick up the verbosity in the SSH daemon config tệp tin to lớn DEBUG and retry again. Often times it's related to lớn tệp tin permissions.
answered Jan 18, năm 2016 at 23:55
3
I am facing the same problem, for má, first change the server(CentOS 7.9) sshd config and allow the password login:
PasswordAuthentication yes
and restart the sshd:
systemctl restart sshd
the next time you login, it will pop the password input. Just input your ssh password or using this command to lớn add no password login:
ssh -p 22 root@{server-ip} 'mkdir -p .ssh && cát >> ~/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub
answered Nov 24, 2023 at 17:07
DolphinDolphin
6793 gold badges22 silver badges43 bronze badges
I've had the same issue before - my key was moved to lớn a different thư mục and I did not update the ssh_config tệp tin.
answered Jul 29, 2020 at 23:31
You must log in to lớn answer this question.
Not the answer you're looking for? Browse other questions tagged
.
Not the answer you're looking for? Browse other questions tagged
.