ssh远程登陆virtualbox debian12

1. 检查ssh是否安装

ps -e | grep ssh

image

只有ssh-agent表示没装

1.1 安装ssh-server

sudo apt install openssh-server -y

image

2. Virtualbox网络设置

image

3. ssh远程登陆

# 获取ip
$ hostname -I

# 远程登陆
$ ssh blue@172.16.237.188

image

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

image

其它问题

blue is not in the sudoers file

$ su root
$ vi /etc/sudoers
blue ALL=(ALL:ALL) ALL

image

设置更新源

$ 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

参考

https://mirrors.tuna.tsinghua.edu.cn/help/debian/

posted @   BuzzWeek  阅读(397)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示