Q
Q
Quad_Tree2015-12-03 18:30:02
linux
Quad_Tree, 2015-12-03 18:30:02

Why can't I connect to the SSH server?

I generate a key:
sudo ssh-keygen
And the key is stored in ~/key.pub
Then I try to copy this key to the server and I get an error:

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Permission denied (publickey).

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
codemix, 2015-12-03
@codemix

try manually copy cat ~/.ssh/id_rsa.pub
create folder

mkdir .ssh
chmod 700 .ssh

and paste the key into the filenano .ssh/authorized_keys

A
alegzz, 2015-12-03
@alegzz

password access is disabled, how are you going to upload the key via ssh if there is no access?
you need to create a .ssh directory in the home directory of the user you plan to login as, and copy the contents of the id_rsa.pub file generated by ssh-keygen into the authorized_keys file. make sure that the ssh server config contains the following line:
AuthorizedKeysFile %h/.ssh/authorized_keys
if not, add and restart the daemon

Y
yvm, 2021-11-21
@yvm

Most likely, fail2ban worked, you have to wait 20 minutes and try again (this time specifying the correct password)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question