Score:0

Permission denied (publickey) while copying id

sj flag

I was trying to copy a key id for password-less SSH access, however it seems that the password authentification is no. I am not sure how to change that.

Here is the original code:

ssh-copy-id xxxx@xxxx

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

xxxx@xxxx: Permission denied (publickey).

user535733 avatar
cn flag
The question seems unclear. Are you asking how to properly set up key-based authentication? Are you saying you made a mistake and locked yourself out? Are you asking how to add a key to a system that you do not administer? Or are you asking something else? Take a look at https://askubuntu.com/questions/46930/how-can-i-set-up-password-less-ssh-login for an overview.
Falio avatar
sj flag
Thank you for the link. Yes, it is what I want to do - a password-less SSH. My problem is that it does not allow me to copy the key, and I have googled some solutions and it seems they all point towards setting the password authentification from no to yes in the cofiguration. However, I am not sure how to do that.
Score:0
cn flag

You must briefly enable password access in order to use ssh-copy-id, then disable it again.

  • Reminder: after enabling/disabling password access, you must restart sshd so it reloads the new configuration.

Example:

server$ sudo nano /etc/ssh/sshd_config        # Enable password login
server$ sudo systemctl restart sshd.service   # Restart sshd

client$ ssh-copy-id [email protected]        # Transmit your key
client$ ssh [email protected]                # Test login using key

server$ sudo nano /etc/ssh/sshd_config        # Disable password login
server$ sudo systemctl restart sshd.service   # Restart sshd
Falio avatar
sj flag
Hello, I managed to enter the configuration regarding the first step and changed 'Password Authentification no' to 'yes'. But what command should I type to exit the configuration and return to the normal ubuntu command window?
Falio avatar
sj flag
I see! So the '^' stands for 'Ctrl'? I did see the instructions but they were all in the form of '^X' or '^R', etc.
user535733 avatar
cn flag
One example of a How To Use Nano tutorial: https://www.youtube.com/watch?v=Jf0ZJZJ8jlI. There are many Nano tutorials out there.
Falio avatar
sj flag
Thank you! It seems I need to use 'sudo /etc/init.d/ssh restart' instead to restart the ssh, I am not sure why (I am quite new to linux). The rest of them worked perfectly, many thanks!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.