I´d like to enable the ssh
root access on Ubuntu 14.04. Editing the /etc/ssh_config
(PermitRootLogin yes) didn't affect anything.

- 145

- 1,459
5 Answers
Simply adding a password for root is not enough for Ubuntu 14.04 Server.
You also need to edit /etc/ssh/sshd_config
, and comment out the following line:
PermitRootLogin without-password
Just below it, add the following line:
PermitRootLogin yes
Then restart SSH:
service ssh reload
For Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-59-generic x86_64) PermitRootLogin without-password
has been replaced by PermitRootLogin prohibit-password
.
You need to setup a password for the root account and then it will work.
sudo passwd
Enter same password twice.
P.S. After modifying /etc/ssh/sshd_config don't forget to reload the openssh server.
sudo service ssh reload
-
2This will work; but to the OP: think twice before doing it. If you still do, and your PC is on the internet, consider adding
fail2ban
to the system. (This comment is related to enabling root login via ssh; having or not a local password for root is just a matter of taste). – Rmano May 19 '14 at 14:08
With Ubuntu 14.04 Server.
Set the password
sudo passwd
Changes in /etc/ssh/sshd_config
Change PermitRootLogin
PermitRootLogin yes
You may also have to check value of PasswordAuthentication. If it is set to no then set to yes
PasswordAuthentication yes
Then restart SSH:
service ssh restart

- 411
-
6This is the only complete answer. Other answers are missing some part. – wisbucky Sep 26 '17 at 18:00
-
-
-
I purged openssh-service and openssh-client on both systems ( Kali Linux and Ubuntu 18 ), reinstalled them, applied this answer and everytihng worked perfectly. – mk1024 Sep 08 '18 at 02:34
-
In my sshd_config, since it has "UsePam yes", and a line "DenyGroups root", besides all above actions, I need to remove the "root" for DenyGroups as well to make it work. – Flickerlight Feb 14 '19 at 07:43
For 14.04 you would have to comment below line in /etc/ssh/sshd_config
#StrictModes yes
-
3Instead of disabling file mode checking, it would be better to ensure, that
/root/.ssh
and the files therein are not readable by any other user than root. – Adaephon Aug 03 '14 at 18:59
For me, none of these steps worked, I've even tried something I wouldn't ever try for something else then a toy vm: PermitRootLogin without-password
The only thing that worked for me was disabling the PAM module for this:
UsePAM no
This option is normally at the very end of the file. To be honest, I don't know the real drawbacks of this, but since you're not supposed to allow root login online, I guess it's okay for a private dev-vm.
Nevertheless, set a strong password, always. Nope this is not an exception. Not even only this time...

- 117
- 4
-
6
PermitRootLogin without-password
doesn't mean the root user gets to log in without authentication. It means the root user isn't allowed to log in with a password. Instead, the root user must log in utilizing RSA keys, which is more secure. – Craig Tullis May 08 '15 at 23:20 -
@Craig the problem I'm referring to is not that root would then need to use RSA SSH-Keys. The problem is that root is a user everyone knocking on the door of your SSH-Server knows exists. Which is not a good thing in my opinion. But feel free to let root login via SSH, but as you said, at least make sure it's using keys to do so! – Kjellski May 09 '15 at 16:13
-
4You said you wouldn't try
PermitRootLogin without-password
for anything but a toy VM. That is what you use to disable password authentication for root, so that the only way root can logon is using RSA keys. You did not state that you tried that option with RSA keys. If you tried that option without keys, there's no way it could succeed. If you usePermitRootLogin without-password
, then you cannot log on using password authentication at all, not with a strong password, not with a blank password, not at all. – Craig Tullis May 10 '15 at 02:30
service ssh reload
is useful. – Torsten Römer Oct 14 '14 at 12:48PermitRootLogin yes
because I had plain password – JorgeeFG Feb 10 '15 at 18:39ssh-copy-id
or another method, you can uncommentPermitRootLogin without-password
and comment out your newPermitRootLogin yes
– pd12 Feb 02 '16 at 00:28service ssh reload
andservice ssh restart
on the server. Yet from the workstation when I dossh root@servername
it still prompts for password then says Permission Denied. – SDsolar Mar 06 '18 at 00:17PasswordAuthentication no
, if you want to login with ssh with password. – bronze man Oct 28 '19 at 01:55