ssh远程登陆virtualbox debian12
1. 检查ssh是否安装
ps -e | grep ssh
只有ssh-agent表示没装
1.1 安装ssh-server
sudo apt install openssh-server -y
2. Virtualbox网络设置
3. ssh远程登陆
# 获取ip
$ hostname -I
# 远程登陆
$ ssh blue@172.16.237.188
4. ssh免密登陆
# 复制公钥
cat id_rsa.pub | ssh blue@172.16.237.188 'cat >> .ssh/authorized_keys'
# 添加host别名
$ vi ~/.ssh/config
Host d12
HostName 172.16.237.188
User blue
IdentityFile ~/.ssh/id_rsa
# 免密登陆
$ ssh d12
其它问题
blue is not in the sudoers file
$ su root
$ vi /etc/sudoers
blue ALL=(ALL:ALL) ALL
设置更新源
$ vi /etc/apt/sources.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
# deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
# deb-src https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware