1、关闭ubuntu的防火墙
ufw disable
开启防火墙
ufw enable
2、卸载iptables
apt-get remove iptables
3、关闭ubuntu中的防火墙的其余命令
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
4、修改root密码
sudo passwd root
5、设置静态IP
sudo vi /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static *******定义为静态IP
address 192.168.2.29 *******所要设置的IP地址
netmask 255.255.255.0 *******子网掩码
gateway 192.168.2.1 *******网关(路由地址)
手动设置DNS服务器
/etc/resolv.conf
nameserver 114.114.114.114
最后重启networking服务
/etc/init.d/networking restart
6、安装openssh并开启远程登录
apt-get install openssh-server
vi /etc/ssh/sshd_config
找到并用#注释掉这行:PermitRootLogin prohibit-password
新建一行 添加:PermitRootLogin yes
重启服务
# service ssh restart