Score:0

"Permission denied" when run "ssh-copy-id node2"

gb flag

I'm using ubuntu 20.04, in the file etc/hostnames, I wrote "192.168.1.1 node2" (node 2 is hostname of another node), then I want to ssh to node2. After I run ssh-keygen, I run ssh-copy-id node2 and then the computer required to enter password, I entered node2 password but computer said "permission denied". But when I run ssh-copy-id [email protected], I can ssh to node2. Why I could not ssh to node 2 by command ssh-copy-id node2 although I configured file etc/hostnames, I also reboot and run as root. May I configured wrong? Please explain me, thanks a lot!

waltinator avatar
it flag
`node2` in `/etc/hosts` (I hope you didn't trash `/etc/hostnames`) associates s. IP address with a hostname. Your use of `ssh-copy-id` is suboptimal, read `man ssh-copy-id`
dominix avatar
us flag
"permission denied" type of problems usualy come from permission on destination machine. did you check the right and permission on the $HOME/.ssh directory and files ? (usualy is 0600) alos the distant $HOME must not be world writable.
hr flag
You seem to be confused about which part of the command refers to the hostname, and which to the username. When you use `ssh-copy-id node2`, it will attempt to copy the id to a user account with the same name as your current local user, whereas `ssh-copy-id [email protected]` will attempt to copy it to an account with the username `node2`
Quý Phạm Đình avatar
gb flag
I had mistake at hostname and username, but the main problem I'm confusing is how can I copy ssh of node2, ip 192.168.1.1 by command "ssh-copy-id node2"
I sit in a Tesla and translated this thread with Ai:

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.