1、给root设置密码,输入下列命令:
sudo passwd
root@ubuntu:~# vi /etc/network/interfaces
#This file describes the network interfaces available on your system
#and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/
#The loopback network interface
auto lo
iface lo inet loopback
auto ens160
iface ens160 inet static
address 192.168.130.237
netmask 255.255.255.0
gateway 192.168.130.1
2、开启ssh
root@ubuntu:~# vi /etc/ssh/sshdconfig
PermitRootLogin yes #(这个改成yes)
3、重启sshd服务
root@ubuntu:~# service sshd restart
4、重启网卡
root@ubuntu:~# /etc/init.d/networking restart
原文:https://blog.51cto.com/chentongsan/2459744