Score:0

achieving "ssh-copy-id" effect without knowing password?

in flag

I have full access to server1.

When I am on server1, I can ssh to server2 without password:

local $ ssh myuser@server1
Welcome to Ubuntu ...
myuser@server1:~$ ssh user2@server2
Welcome to Ubuntu ...
user2@server2:~$ 

I would like to login to server2 directly:

local $ ssh user2@server2

The problem is, I don't know the password for server2.

I went to server1, listed the contents of ~/.ssh/authorized_keys

Then I ssh to server2 and copied those lines at the end of ~/.ssh/authorized_keys there.

But when I try to ssh user2@server2, it's still asking me for password. What am I doing wrong?

ChanganAuto avatar
us flag
You need the password.
waltinator avatar
it flag
Add the `-v` option to your `ssh` commands. Add multiple `-v` to get much more data. Unnecessary for first level diagnosis. Compare results. Read `man ssh`.
waltinator avatar
it flag
"I don't know the password for server2" seems suspicious. Who manages server2?
hr flag
I guess it's possible that server2's SSH server is configured with publickey as an authentication option when connecting from server1 but not from other clients... or even configured to allow [host-based authentication](https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Host-based_Authentication) from server1
Marjeta avatar
in flag
@waltinator I forgot the password, and I'd rather not jump through the hoops needed to get it reset.
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.