I know that for you users and the ones that you create you can use ssh keys to connect to another machines. You just create the ssh key import it to the target machine and then when you login next, no password will be asked.

But.... what if someone one wants to use the same for root user? Is it possible? Is it recommended? Is it secure?

And if I want to setup the ssh key for root, how should I do it? Like normal user?

  • 4
    SSH into the machine as a normal user. Then set up sudo for that user. Disable root login over SSH.
    – Kusalananda
    Oct 17, 2018 at 13:55

1 Answer 1


Security 101, do not use root account when you can avoid it.
It's not recommanded to setup a SSH connection as root on your server.
Still if you want to do it, disable password authentication and encrypt your ssh key with strong password.
You can proceed exactly the same way as you would do with a regular user if you want to.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .