Ubuntu doesn't allow root user and also login in ssh as root by default. But sometimes, remote sftp login has better convenience in editing the system files such as nginx config so it can be edited in GUI. As a precaution, This method is not recommended in production for security reason. So the first thing you have to do is:
- Enable your root user account in remote server:
sudo passwd root
- Fill in your password.
- Root account is enabled now. Make sure openssh-server is installed and be able to edit the ssh config:
sudo nano /etc/ssh/sshd_config
- Find the line contains
PermitRootLogin no
, modify it toPermitRootLogin yes
. or just add it.Now restart the ssh server:sudo service ssh restart
- Now give it a try by using
ssh root@remotehost
from your computer to the server.