I can't connect to a server using ssh-copy-id
Clash 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.
ssh ssh-config
add a comment |Â
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.
ssh ssh-config
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, thessh-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... ChangingPasswordAuthentication no
toPasswordAuthentication yes
should allow you to copy the public keys usingssh-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
add a comment |Â
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.
ssh ssh-config
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
ssh ssh-config
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, thessh-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... ChangingPasswordAuthentication no
toPasswordAuthentication yes
should allow you to copy the public keys usingssh-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
add a comment |Â
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, thessh-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... ChangingPasswordAuthentication no
toPasswordAuthentication yes
should allow you to copy the public keys usingssh-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
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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... ChangingPasswordAuthentication no
toPasswordAuthentication yes
should allow you to copy the public keys usingssh-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