M
M
Mika Slepinin2016-11-03 18:43:12
linux
Mika Slepinin, 2016-11-03 18:43:12

How can I use ssh keys from the machine on which I am a user to connect to the machine on which I need to work as root?

There is a remote machine on which you need to work as root. On my machine, I work as a user, I do ssh-copy-id 192.168.2.3 (I also did ssh-copy-id [email protected]). But when I want to connect, it still asks for the root password. How to make sure that he does not ask? Really users on both hosts should be under one name?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Mika Slepinin, 2016-11-07
@mikalaikaia

All figured out. It was necessary to add the following line to /etc/ssh/sshd_config:
no other parameters in the config can be changed at all.
It is also important to execute the command on the host from which you are connecting:
$ ssh-add

N
Ne-Lexa, 2016-11-03
@NeLexa

Check the /root/.ssh/authorized_keys file for the required public key.

S
Saboteur, 2016-11-03
@saboteur_kiev

did: ssh-copy-id [email protected]
How are you connecting? ssh [email protected] ?
On some systems, remote root access is discouraged, it's better to connect to a remote machine as a user and if absolutely necessary, immediately execute sudo bash by configuring /etc/sudoers so that it does not ask for extra passwords
and do ssh -v [email protected]
to see the log in more detail that's not right there.

C
CityCat4, 2016-11-03
@CityCat4

If the ability to log in as a root is disabled on a remote server, then at least stand on your head - you can’t connect with a root. You need to connect as a normal user, and then su or sudo.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question