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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章