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 '18 at 13:55

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.