1、拉取openeuler鏡像
選擇的版本是
openeuler/openeuler:22.03-lts-sp2
2、run一個容器
docker run -d -it -p 自定義SSH端口:22 --privileged --gpus all --name openEuler22 openeuler/openeuler:22.03-lts-sp2 /bin/bash
注意:
不支持命令結(jié)尾使用/sbin/init參數(shù)
翹里哇!
然而使用/bin/bash參數(shù)創(chuàng)建的容器中,不支持systemctl命令
翹里哇!!
不支持拉雞八倒!!!
3、進入容器
docker exec -it openEuler22(容器名) bash
4、安裝ssh
yum install openssh-server
5、配置ssh
(1)進入/etc/ssh下面,ll一下發(fā)現(xiàn)只有兩個文件
moduli
sshd_config
并沒有公鑰文件(你麻痹在ubuntu中安裝了openssh-server之后會自動創(chuàng)建公鑰文件)
(2)創(chuàng)建公鑰
ssh-keygen -A
再次ll一下發(fā)現(xiàn)創(chuàng)建了一組公鑰文件
ssh_host_dsa_key
ssh_host_ecdsa_key
ssh_host_ed25519_key
(3)編輯sshd_config
打開sshd_config文件,找到這一組代碼
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
把
HostKey /etc/ssh/ssh_host_rsa_key
注釋掉,改成
HostKey /etc/ssh/ssh_host_dsa_key
保存退出
6、啟動ssh服務(wù)
找找ssh的可執(zhí)行文件裝哪里了。
進入目錄/etc/init.d/
啥也沒有
(ubuntu中位于/etc/init.d/下,名為ssh,執(zhí)行啟動命令/etc/init.d/ssh start即可啟動ssh服務(wù))
find一下
find / -name ssh
沒有find命令!
你麻辣隔壁啊!翹里哇!
安裝find命令:
yum install findutils
再次執(zhí)行find命令:
find / -name ssh
發(fā)現(xiàn)在這里:
/usr/sbin/
執(zhí)行ssh命令:
/usr/sbin/sshd
執(zhí)行命令:
ps -ef|grep sshd
看到sshd進程已經(jīng)啟動
7、設(shè)置root密碼
passwd root
沒有passwd命令!
翹里哇!
安裝passwd
yum install passwd
再次執(zhí)行passwd root設(shè)置密碼
8、ssh登陸
在mobaxtrem中ssh登陸
O了!
去你爹個懶子!!!!!!!!!
posted on 2024-01-22 03:56
小王 閱讀(112)
評論(0) 編輯 收藏 引用 所屬分類:
Docker