31.编译安装dropbear
32.创建远程登录时,用到的目录
33.为目标系统生成密钥文件
34.设置安全的shells
35.开启网络服务转换功能
36.复制相应的库文件,路径要对应,没有则创建之
37.测试
31.编译安装dropbear
Dropbear是一个相对较小的SSH服务器和客户端
[[email protected] ~]# tar xf dropbear-2016.73.tar.bz2 [[email protected] ~]# cd dropbear-2016.73 [[email protected] dropbear-2016.73]# ./configure [[email protected] dropbear-2016.73]# make && make install 复制相应的目录到目标主机对应的目录上(目录不存在则创建之) [[email protected] dropbear-2016.73]# which dropbear /usr/local/sbin/dropbear [[email protected] dropbear-2016.73]# mkdir /mnt/sysroot/usr/local/sbin/ -pv mkdir: created directory ‘/mnt/sysroot/usr/local‘ mkdir: created directory ‘/mnt/sysroot/usr/local/sbin/‘ [[email protected] dropbear-2016.73]# cp /usr/local/sbin/dropbear /mnt/sysroot/usr/local/sbin/ [[email protected] dropbear-2016.73]# which dropbearkey /usr/local/bin/dropbearkey [[email protected] dropbear-2016.73]# mkdir /mnt/sysroot/usr/local/bin/ -pv mkdir: created directory ‘/mnt/sysroot/usr/local/bin/‘ [[email protected] dropbear-2016.73]# cp /usr/local/bin/dropbearkey /mnt/sysroot/usr/local/bin/ [[email protected] dropbear-2016.73]# which dbclient /usr/local/bin/dbclient [[email protected] dropbear-2016.73]# cp /usr/local/bin/dbclient /mnt/sysroot/usr/local/bin/ [[email protected] dropbear-2016.73]# tree /mnt/sysroot/usr/local/ /mnt/sysroot/usr/local/ ├── bin │ ├── dbclient │ └── dropbearkey └── sbin └── dropbear 2 directories, 3 files
32.创建远程登录时,用到的目录
[[email protected] dropbear-2016.73]# cd /mnt/sysroot/ [[email protected] sysroot]# mkdir dev/pts [[email protected] sysroot]# vim etc/fstab sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 /dev/sda1 /boot ext4 defaults 0 0 /dev/sda2 / ext4 defaults 0 0 devpts /dev/pts devpts mode=620 0 0 --> 添加此行,实现开机自动挂载;mode 表示权限
33.为目标系统生成密钥文件
[[email protected] sysroot]# mkdir etc/dropbear [[email protected] sysroot]# cd etc/dropbear/ [[email protected] dropbear]# dropbearkey -t rsa -s 2048 -f dropbear_rsa_host_key [[email protected] dropbear]# dropbearkey -t dss -f dropbear_dss_host_key
34.设置安全的shells
[[email protected] sysroot]# vim etc/shells /bin/bash /bin/ash /bin/sh /bin/hush /sbin/nologin
35.开启网络服务转换功能
[[email protected] sysroot]# vim etc/nsswitch.conf passwd:files group:files shadow:files hosts:files dns
36.复制相应的库文件,路径要对应,没有则创建之
[[email protected] sysroot]# mkdir usr/lib64 [[email protected] sysroot]# cp -d /lib64/libnss_files* lib64/ [[email protected] sysroot]# cp -d /usr/lib64/libnss3.so usr/lib64/ [[email protected] sysroot]# cp -d /usr/lib64/libnssutil3.so usr/lib64/ [[email protected] sysroot]# cp -d /usr/lib64/libnss_files* usr/lib64/
37.测试
[[email protected] sysroot]# sync [[email protected] sysroot]# sync 关闭宿主机 开启mini Linux 启动dropbear程序 利用另一台Linux 使用ssh登录到mini Linux
时间: 2024-10-09 23:18:27