在最近学习 eBPF 时,因为在 mac 貌似除了 multipass 之外没有好用的命令行虚拟机,于是选择了 multipass 作为开发环境,使用 vscode ssh 连接。
但是发现死活都连不上虚拟机。起初修改了 sshd_config,添加以下代码
# 允许使用 Root 帳號進行登入
PermitRootLogin yes
# 允許使用公鑰進行登入
PubkeyAuthentication yes
# 允許使用帳號密碼進行登入
PasswordAuthentication yes
发现仍然出现问题。根据网上教程发现/etc/ssh/sshd_config.d/60-cloudimg-settings.conf
还有一处配置文件,于是对该配置文件进行修改后,重启 ssh 服务生效。
允许密码登录: PermitRootLogin yes
重启 ssh 服务: sudo systemctl restart ssh