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

相關文章
相關標籤/搜索