Ubuntu系统的IP配置

用过ubuntu的人都知道,刚安装好系统root用户是没有密码的,没有密码我们就没法用root用户登录,给root用户设置密码输入命令 sudo passwd,然后系统会让你输入密码,这时输入的密码就是root用户的密码了,设置完成之后就可以切换root用户登录了,如图:

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

猜你喜欢

转载自blog.51cto.com/chentongsan/2459744