Skip to main content

Completely solve the problem of Ubuntu SSH being unable to log in remotely and SSH root login ACCESS Denied.

I installed Ubuntu 16.04 using a VM virtual machine and found two problems using SSH remote connection (different from Centos).

First, SSH cannot connect to the newly created virtual server.

The reason is that Ubuntu does not install the SSH service by default and needs to be installed manually.

  1. sudo ps -e |grep ssh #Check whether the SSH service is installed (if it is empty, it is not installed)

  2. sudo apt-get update #Update the resource list first

  3. sudo apt-get install openssh-server #Install openssh-server

  4. sudo ps -e |grep ssh #Check whether the installation is successful

  5. sudo service sshd start #Restart the SSH service (or use the command sudo systemctl restart sshd)

Second, root login ACCESS Denied problem

After the first problem was solved, it was found that the following problems occurred when logging in as root through remote SSH connection:

The solution is as follows:

1. sudo vi /etc/ssh/sshd_config

Comment out PermitRootLogin prohibit-password

Add a line PermitRootLogin yes as shown below:

2. Restart systemctl restart sshd

3. Re-log in to SSH remotely using root and the problem is solved!