When the Ubantu is loaded, there may be a small partner that ignores a bit and forgets to play a space in one place, resulting in the inability to connect remotely.
If you can make a tick here, you can not use the following operation.
To switch to the root account first
sudo passwd root switch to root
However, you must first enter the password of the normal user, which is the current user's password.
Then enter the root password two times so that the root password is set.
Switch to root user
The SU root enters the password.
There is no connection to SSH because there is no response to the package Openssh-server so the package to install this response
Configure the SSH service to enter the configuration directory after the installation is complete
To configure the configuration file, first comment out Permitrootlogin Prohibit-password (comment on line 28th)
Add Permitrootlogin Yes at the bottom of this line (added on line 29th)
Modify the previous configuration file
After modification
Restart the SSH service
View IP Address
Connect with Xshell
Fix Ubuntu can't connect remotely