I can't connect to a server using ssh-copy-id

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I had created a new server, and I would like to connect to it using an ssh public key. I have the following config /etc/ssh/sshd_config:



Port 22222
PermitRootLogin yes
AuthorizedKeysFile .ssh/authorized_keys
RSAAuthentication yes
PasswordAuthentication no


I tried to connect as follows:



ssh-copy-id -i ~/.ssh/id_rsa.pub root@remotehost -p 22222
ssh-copy-id -i ~/.ssh/id_rsa root@remotehost -p 22222
ssh-copy-id -p 22222 root@remotehost -i ~/.ssh/id_rsa.pub
ssh-copy-id -i ~/.ssh/id_rsa.pub "root@remotehost -p 22222"
ssh -p22222 root@remotehost"cat >> ~/.ssh/authorized_keys" < ~/.ssh/id_rsa.pub


But, I got the following errors:



/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/Users/alex/.ssh/id_rsa.pub"
/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).


However, I can connect to other servers using this key. When connecting to the server, the console do not provide a password from the key.



I can not understand what the problem is. I did everything similar to the setup of my other servers, but there is no connection to this server. I rebooted the server and the services after making all the settings.










share|improve this question



















  • 1




    You need to authenticate to the server before the public key is copied. In your setup, you've already set Password authentication to "No" ... So, the ssh-copy-id command will fail since there is no ability to authenticate to the server.... You will need to enable Password authentication or already have a public key installed on the server for that user before Authentication can occur to copy the new public key to the server's ~/.ssh/authorized_keys file.
    – RubberStamp
    Sep 22 at 12:28










  • @RubberStamp How I said I make it before connect to server, I wrote It in P.S.
    – Alex Storm
    Sep 22 at 17:16










  • The error is included in your question. ..... the last line of the included messages reads Permission denied (publickey) .... this means the server is expecting to authenticate using only public keys. So, if there's no public listed in the ~/.ssh/authorized_keys on the server, there's no method available for authentication... Changing PasswordAuthentication no to PasswordAuthentication yes should allow you to copy the public keys using ssh-copy-id ... you can then change the setting back to "no" ... any future keys can be installed without changing back to "yes"
    – RubberStamp
    Sep 22 at 17:30














up vote
0
down vote

favorite












I had created a new server, and I would like to connect to it using an ssh public key. I have the following config /etc/ssh/sshd_config:



Port 22222
PermitRootLogin yes
AuthorizedKeysFile .ssh/authorized_keys
RSAAuthentication yes
PasswordAuthentication no


I tried to connect as follows:



ssh-copy-id -i ~/.ssh/id_rsa.pub root@remotehost -p 22222
ssh-copy-id -i ~/.ssh/id_rsa root@remotehost -p 22222
ssh-copy-id -p 22222 root@remotehost -i ~/.ssh/id_rsa.pub
ssh-copy-id -i ~/.ssh/id_rsa.pub "root@remotehost -p 22222"
ssh -p22222 root@remotehost"cat >> ~/.ssh/authorized_keys" < ~/.ssh/id_rsa.pub


But, I got the following errors:



/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/Users/alex/.ssh/id_rsa.pub"
/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).


However, I can connect to other servers using this key. When connecting to the server, the console do not provide a password from the key.



I can not understand what the problem is. I did everything similar to the setup of my other servers, but there is no connection to this server. I rebooted the server and the services after making all the settings.










share|improve this question



















  • 1




    You need to authenticate to the server before the public key is copied. In your setup, you've already set Password authentication to "No" ... So, the ssh-copy-id command will fail since there is no ability to authenticate to the server.... You will need to enable Password authentication or already have a public key installed on the server for that user before Authentication can occur to copy the new public key to the server's ~/.ssh/authorized_keys file.
    – RubberStamp
    Sep 22 at 12:28










  • @RubberStamp How I said I make it before connect to server, I wrote It in P.S.
    – Alex Storm
    Sep 22 at 17:16










  • The error is included in your question. ..... the last line of the included messages reads Permission denied (publickey) .... this means the server is expecting to authenticate using only public keys. So, if there's no public listed in the ~/.ssh/authorized_keys on the server, there's no method available for authentication... Changing PasswordAuthentication no to PasswordAuthentication yes should allow you to copy the public keys using ssh-copy-id ... you can then change the setting back to "no" ... any future keys can be installed without changing back to "yes"
    – RubberStamp
    Sep 22 at 17:30












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I had created a new server, and I would like to connect to it using an ssh public key. I have the following config /etc/ssh/sshd_config:



Port 22222
PermitRootLogin yes
AuthorizedKeysFile .ssh/authorized_keys
RSAAuthentication yes
PasswordAuthentication no


I tried to connect as follows:



ssh-copy-id -i ~/.ssh/id_rsa.pub root@remotehost -p 22222
ssh-copy-id -i ~/.ssh/id_rsa root@remotehost -p 22222
ssh-copy-id -p 22222 root@remotehost -i ~/.ssh/id_rsa.pub
ssh-copy-id -i ~/.ssh/id_rsa.pub "root@remotehost -p 22222"
ssh -p22222 root@remotehost"cat >> ~/.ssh/authorized_keys" < ~/.ssh/id_rsa.pub


But, I got the following errors:



/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/Users/alex/.ssh/id_rsa.pub"
/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).


However, I can connect to other servers using this key. When connecting to the server, the console do not provide a password from the key.



I can not understand what the problem is. I did everything similar to the setup of my other servers, but there is no connection to this server. I rebooted the server and the services after making all the settings.










share|improve this question















I had created a new server, and I would like to connect to it using an ssh public key. I have the following config /etc/ssh/sshd_config:



Port 22222
PermitRootLogin yes
AuthorizedKeysFile .ssh/authorized_keys
RSAAuthentication yes
PasswordAuthentication no


I tried to connect as follows:



ssh-copy-id -i ~/.ssh/id_rsa.pub root@remotehost -p 22222
ssh-copy-id -i ~/.ssh/id_rsa root@remotehost -p 22222
ssh-copy-id -p 22222 root@remotehost -i ~/.ssh/id_rsa.pub
ssh-copy-id -i ~/.ssh/id_rsa.pub "root@remotehost -p 22222"
ssh -p22222 root@remotehost"cat >> ~/.ssh/authorized_keys" < ~/.ssh/id_rsa.pub


But, I got the following errors:



/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/Users/alex/.ssh/id_rsa.pub"
/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).


However, I can connect to other servers using this key. When connecting to the server, the console do not provide a password from the key.



I can not understand what the problem is. I did everything similar to the setup of my other servers, but there is no connection to this server. I rebooted the server and the services after making all the settings.







ssh ssh-config






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 22 at 11:10









Goro

6,20152763




6,20152763










asked Sep 22 at 10:51









Alex Storm

1




1







  • 1




    You need to authenticate to the server before the public key is copied. In your setup, you've already set Password authentication to "No" ... So, the ssh-copy-id command will fail since there is no ability to authenticate to the server.... You will need to enable Password authentication or already have a public key installed on the server for that user before Authentication can occur to copy the new public key to the server's ~/.ssh/authorized_keys file.
    – RubberStamp
    Sep 22 at 12:28










  • @RubberStamp How I said I make it before connect to server, I wrote It in P.S.
    – Alex Storm
    Sep 22 at 17:16










  • The error is included in your question. ..... the last line of the included messages reads Permission denied (publickey) .... this means the server is expecting to authenticate using only public keys. So, if there's no public listed in the ~/.ssh/authorized_keys on the server, there's no method available for authentication... Changing PasswordAuthentication no to PasswordAuthentication yes should allow you to copy the public keys using ssh-copy-id ... you can then change the setting back to "no" ... any future keys can be installed without changing back to "yes"
    – RubberStamp
    Sep 22 at 17:30












  • 1




    You need to authenticate to the server before the public key is copied. In your setup, you've already set Password authentication to "No" ... So, the ssh-copy-id command will fail since there is no ability to authenticate to the server.... You will need to enable Password authentication or already have a public key installed on the server for that user before Authentication can occur to copy the new public key to the server's ~/.ssh/authorized_keys file.
    – RubberStamp
    Sep 22 at 12:28










  • @RubberStamp How I said I make it before connect to server, I wrote It in P.S.
    – Alex Storm
    Sep 22 at 17:16










  • The error is included in your question. ..... the last line of the included messages reads Permission denied (publickey) .... this means the server is expecting to authenticate using only public keys. So, if there's no public listed in the ~/.ssh/authorized_keys on the server, there's no method available for authentication... Changing PasswordAuthentication no to PasswordAuthentication yes should allow you to copy the public keys using ssh-copy-id ... you can then change the setting back to "no" ... any future keys can be installed without changing back to "yes"
    – RubberStamp
    Sep 22 at 17:30







1




1




You need to authenticate to the server before the public key is copied. In your setup, you've already set Password authentication to "No" ... So, the ssh-copy-id command will fail since there is no ability to authenticate to the server.... You will need to enable Password authentication or already have a public key installed on the server for that user before Authentication can occur to copy the new public key to the server's ~/.ssh/authorized_keys file.
– RubberStamp
Sep 22 at 12:28




You need to authenticate to the server before the public key is copied. In your setup, you've already set Password authentication to "No" ... So, the ssh-copy-id command will fail since there is no ability to authenticate to the server.... You will need to enable Password authentication or already have a public key installed on the server for that user before Authentication can occur to copy the new public key to the server's ~/.ssh/authorized_keys file.
– RubberStamp
Sep 22 at 12:28












@RubberStamp How I said I make it before connect to server, I wrote It in P.S.
– Alex Storm
Sep 22 at 17:16




@RubberStamp How I said I make it before connect to server, I wrote It in P.S.
– Alex Storm
Sep 22 at 17:16












The error is included in your question. ..... the last line of the included messages reads Permission denied (publickey) .... this means the server is expecting to authenticate using only public keys. So, if there's no public listed in the ~/.ssh/authorized_keys on the server, there's no method available for authentication... Changing PasswordAuthentication no to PasswordAuthentication yes should allow you to copy the public keys using ssh-copy-id ... you can then change the setting back to "no" ... any future keys can be installed without changing back to "yes"
– RubberStamp
Sep 22 at 17:30




The error is included in your question. ..... the last line of the included messages reads Permission denied (publickey) .... this means the server is expecting to authenticate using only public keys. So, if there's no public listed in the ~/.ssh/authorized_keys on the server, there's no method available for authentication... Changing PasswordAuthentication no to PasswordAuthentication yes should allow you to copy the public keys using ssh-copy-id ... you can then change the setting back to "no" ... any future keys can be installed without changing back to "yes"
– RubberStamp
Sep 22 at 17:30















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f470692%2fi-cant-connect-to-a-server-using-ssh-copy-id%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f470692%2fi-cant-connect-to-a-server-using-ssh-copy-id%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay