Dave, I’ve been using ssh like a good Internet citizen to connect to my remote server, but for security reasons the ISP has disabled root login from ssh on every server. Problem is, I really need to be able to log in as root occasionally. How do I re-enable it?
First off, are you absolutely sure this is something that you really want to do? Remember, you should have a regular user account already, and it’s only a few extra keystrokes to ssh to your account, then use su or sudo to become root for specific tasks. That’s what I do, and that’s what I recommend too.
Further, you already know that you should have a really weird, impossible-to-break or guess root password, right? One tip: most Unixes let you have arbitrarily long passwords, so don’t hesitate to do something that’s more than the usual 6-8 characters, and, really, add some punctuation and mixed upper/lower case letters, at a minimum.
For example, my root password is . See what I mean?
More seriously, if you are convinced that you really do want to reenable root login through ssh then you’ll want to follow these two simple steps:
- Open up /etc/ssh/sshd_config and set “PermitRootLogin” to “yes”. (Your ISP probably set it to “without-password”)
- You also need to restart the sshd process. This is done by killing the existing one (use ps -aux|grep sshd to get the process ID, then use kill to zap it), then restarting /usr/sbin/sshd
Again, make me feel more secure. Make sure you really want to do this, and then make sure that you have a really solid, impossible to guess root password.