Ubuntu系统的IP配置

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

一、给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 ssh

二、开启ssh
root@ubuntu:~# vi /etc/ssh/sshdconfig
PermitRootLogin yes #(这个改为yes)
三、重启sshd服务
root@ubuntu:~# service sshd restart
四、重启网卡
root@ubuntu:~# /etc/init.d/networking restartide

相关文章
相关标签/搜索