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
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop














{ 10 comments… read them below or add one }
Your command for sshd is incorrect – should be:
# /etc/init.d/sshd restart
You were missing the “d” for sshd
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
Most people would be wanting to know how to enable this, to secure their boxes. Perhaps the unknown asker doesn’t know how to use sudo or su properly so that you can log in remotely via a safe, unprivileged user account and then, once the connection is secure, issue privileged commands or switch to a privileged account? Or perhaps s/he wishes to have unrestricted access to the computer with no tracking of who issued what commands?
just do a ” svcadm restart ssh”
That only would work on Solaris :-)
Hi,
I wanted to enable root login via ssh in my server, but couldn’t see the below file on the server. Please help.
/etc/ssh/sshd_config
One year late, but maybe it will be helpful for somebody else:
it’s possible that you don’t see the sshd_config file because you don’t have the OpenSSH suite (or any other ssh servers) installed on the remote machine.
You also need to add root to Allowusers
Hi there :)
how can you change sshd_config file to enable root ssh access, since you can not login to ssh with root?
I can only login in ssh with a user password, i have the root password too but first i have to change that file wich is readonly and I can not change it, I tried “chmod a=rwx sshd_config” but “operation not permitted” ..
thanks
Thanks, tips works on my Debian :).