I´d like to enable the ssh
root access on Ubuntu 14.04. Editing the /etc/ssh_config
(PermitRootLogin yes) didn't affect anything.
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
.
-
10
-
2
-
1If doing this while ssh or scp tells you "Permission denied, please try again" in another window, quit and retry that ssh (or scp) instead of just re-typing in the password. Feb 10, 2015 at 21:48
-
1Once you copy your ssh key using
ssh-copy-id
or another method, you can uncommentPermitRootLogin without-password
and comment out your newPermitRootLogin yes
– pd12Feb 2, 2016 at 0:28 -
1Also don't forget to check if root is mentioned in sshd_config: AllowUsers root– JanDec 13, 2016 at 23:31
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).– RmanoMay 19, 2014 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
-
6This is the only complete answer. Other answers are missing some part.– wisbuckySep 26, 2017 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.– mk1024Sep 8, 2018 at 2: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. Feb 14, 2019 at 7: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.– AdaephonAug 3, 2014 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...
-
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. May 8, 2015 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!– KjellskiMay 9, 2015 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. May 10, 2015 at 2:30