允许 root 账号 SSH 登录
# 1.编辑 ssh 配置文件
vim /etc/ssh/sshd_config
# 2.打开 ROOT 账号远程登录的开关 change `prohibit-password` to yes
#PermitRootLogin prohibit-password
PermitRootLogin yes
# 3.重启 ssh 服务
service ssh restart
自定义 IP
# 执行 sudo vim /etc/netplan/50-cloud-init.yaml
network:
ethernets:
enp0s5:
dhcp4: false
addresses:
# 自定义ip地址
- 10.211.55.7/24
gateway4: 10.211.55.1
nameservers:
addresses:
- 8.8.8.8
- 114.114.114.114
search: []
version: 2
# 执行 sudo netplan apply 让配置生效
修改主机名 HostName
# 1.修改需要的主机名 :
sudo vim /etc/hostname
# 2.将preserve_hostname: false修改为true
sudo vim /etc/cloud/cloud.cfg
# 3.保存退出 :
sudo reboot
加速 SSH
sudo vim sshd_config
# 打开
UseDNS no
安装 sshpass
# "msg": "to use the 'ssh' connection type with passwords,
# you must install the sshpass program"
apt install sshpass