一贺辰、root用戶ssh登錄
普通用戶登錄系統(tǒng)猫胁,輸入命令:sudo passwd root(使用root權(quán)限為root更改密碼)
20180730181436364.png
vi /etc/ssh/sshd_config
PermitRootLogin yes (默認(rèn)為#PermitRootLogin prohibit-password)
:wq
sudo service ssh restart
二、配置網(wǎng)卡
ubuntu18.04使用netplan這個(gè)工具去管理網(wǎng)絡(luò)部服,所以修改網(wǎng)址也有變化:vi /etc/netplan/50-cloud-init.yaml
network:
ethernets:
ens33:
addresses: [192.168.100.110/24] #默認(rèn)是[] 添加你要的ip地址
dhcp4: no #默認(rèn)是true,改成no即可
gateway4: 192.168.100.1 #模式是沒有的,需要手動(dòng)添加
nameservers:
addresses: [114.114.114.114,8.8.8.8] #set dns
optional: true
version: 2
設(shè)置完成后电湘,使用命令:netplan apply 即可生效梅屉。
三痢士、修改主機(jī)名
1彪薛、sudo vim /etc/cloud/cloud.cfg
找到preserve_hostname: false修改為preserve_hostname: true
2、修改主機(jī)名 sudo vim /etc/hostname
然后改為需要的主機(jī)名后存盤退出
3怠蹂、映射主機(jī)名 sudo vim /etc/hosts
添加192.168.1.xxx 主機(jī)名 然后sudo reboot