Allow root account to use SSH (openssh)
Q. Previous admin blocked root access to ssh server. How do I allow root account access to ssh server?
A. Allowing direct root access over ssh is a security risk. However following steps will allow you to login as root over ssh session:
Open sshd_config file:
# vi /etc/ssh/sshd_config
Find out line that read as follows:
PermitRootLogin no
Set it as follows:
PermitRootLogin yes
Find out line that read as follows (this line may not exists in your configuration):
DenyUsers root user2 user3
Set is as follows:
DenyUsers user2 user3
Save and close the file. Restart the sshd:
# /etc/init.d/ssh restart
E-mail this to a friend
Printable version
Related Other Helpful FAQs:
- Can I create another root user account in Linux / UNIX?
- Linux locking an account
- How to add a ssh user in FreeBSD server
- FreeBSD locking an account
- Understanding Linux / UNIX root user or superuser and how should I use root on my server?
Discussion on This FAQ
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!




April 13th, 2007 at 7:04 pm
Your command for sshd is incorrect - should be:
# /etc/init.d/sshd restart
You were missing the “d” for sshd
April 14th, 2007 at 8:59 pm
Mika,
It can be ssh or sshd - it depends upon your Linux distro. Redhat/CentOS/FC use sshd and ssh used by Debian or Ubuntu and so on..
HTH