sudo vim /etc/netplan/50-cloud-init.yaml
在文件末尾增加语句(如果有直接修改)
network:
version: 2
wifis:
wlan0:
access-points:
"WIFI名称":
password: "密码"
dhcp4: true
optional: true
之后保存退出,在命令行输入命令
sudo netplan generate
sudo netplan apply