How to disable SSH root access and create other user

Latest response

Hi everyone,

I would like to enable port forwarding on my router to reach my laptop with Red Hat from outside in SSH but I would not want to do it as root but with another limited user and then once logged in change with the command su -.
Can you tell me the steps that I have to carry out and how should I intervene at the configuration level?
And can you also tell me how to make access safer, perhaps through the use of certificates and how to generate them?

Thank you all.


In /etc/ssh/sshd_config you can PermitRootLogin no so root can't SSH in.

As you suggested, you could also disable SSH password logins altogether and allow only SSH key-based authentication:

Once you're logged in, if you know the root password then you can su - or you can control access more precisely via sudo, which can allow certain users to only run certain commands with root priviledges:

Hi Jamie,

many thanks for the help.