Ubuntu: Not able to ssh as root on 14.04.2



Question:

I have done all the workarounds, yet, I am still not able to ssh as root. I have already modified PermitRootLogin to yes, and I have reset ssh services. I have even rebooted the VM, but it is just not working.

# Authentication:  LoginGraceTime 120  PermitRootLogin yes  StrictModes yes  


Solution:1

There is no 'root' account available for login by default. It is locked in a default installation. You don't state where your install runs from, so I am going to assume it's running from your remote user account on the server.

You can enable the root account if you wish, but there's more 'secure' approaches to do this, than just enabling the account. I've detailed some approaches to gaining root privileges to run an installation file on a system.


The safe way: Use sudo to temporarily gain root privileges for the application to run as once.

Assuming this is a file you have to execute, you can run your installer as root by running this command, replacing /path/to/installer with the real path:

sudo /path/to/installer  

The not-as-safe way: Use sudo to drop into a root shell prompt, and execute installation commands.

Run this command top drop yourself into a root login, and then you can run commands as superuser:

sudo su -  

Once here, execute the command as you would without sudo:

/path/to/installer  

Note that this is a very dangerous thing - you can literally break your system with this approach if you don't know what you're doing on the command line.

Once done, exit the shell and drop back to your unprivileged user.


The extremely dangerous insecure way: Enable root account by setting a password

WARNING!

Before attempting ANY of these commands, be aware that by enabling the root account, and permitting Root Login with "Yes" and not "without-password" through ssh, if even for just a moment, you are opening your system to brute-force login attempts and other security risks. If you do this, then AS SOON AS IS LOGICAL you should re-disable the root account.

Either set PermitRootLogin without-password and configure SSH Key Authentication, or understand that as soon as you are done, you should lock the root account again, and set PermitRootLogin to no or without-password.

The least secure approach is to enable the root account by setting a password. You can do this by using this command on your user who has sudo privileges (you don't have to specify 'root' here though):

sudo passwd  

Set a root password (the password will not display, nor will any asterisks, but it is accepting the password), then the root account will be activated. You will then be able to login to the account, based on your existing SSH settings you stated.

As soon as you no longer need the root user, please run this to re-disable and re-lock the root user from your sudo-enabled account:

sudo passwd -l root  

You should also set PermitRootLogin to no or without-password in your sshd_config as well when you do this.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »