by codelitt · 10y ago · 0 comments
I do make sure later in the article that `/etc/ssh/sshd_config` does not allow root login:
PermitRootLogin no
But you make a good point that a simple solution is just having no root password at all. If your VPS does have a root login by default, then I believe you can get rid of it with: sudo usermod -p '!' root
The best part about sharing things like this is getting all sorts of great info and input on things. sudo passwd -lThe security disadvantage is that if someone gets your /etc/shadow file they can still see the password hash, in case they wanted to try to crack it, but honestly at that point your server is likely compromised anyway.
Regardless -- I'm not trying to diminish your solution, nor Linux; I elided over the usermod example in the grandparent (didn't recognize it at all), but interestingly, as I look on my NetBSD system,there is a usermod(8), with a -p for already hashed passwords. As I test it though, it rejects '!' as an argument:
# usermod -p ! jnk
usermod: Can't modify user `jnk': invalid password: `!'