31.編譯安裝dropbearshell
32.建立遠程登陸時,用到的目錄vim
33.爲目標系統生成密鑰文件centos
34.設置安全的shells安全
35.開啓網絡服務轉換功能bash
36.複製相應的庫文件,路徑要對應,沒有則建立之服務器
37.測試網絡
31.編譯安裝dropbearssh
Dropbear是一個相對較小的SSH服務器和客戶端ide
[root@centos6 ~]# tar xf dropbear-2016.73.tar.bz2 [root@centos6 ~]# cd dropbear-2016.73 [root@centos6 dropbear-2016.73]# ./configure [root@centos6 dropbear-2016.73]# make && make install 複製相應的目錄到目標主機對應的目錄上(目錄不存在則建立之) [root@centos6 dropbear-2016.73]# which dropbear /usr/local/sbin/dropbear [root@centos6 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/' [root@centos6 dropbear-2016.73]# cp /usr/local/sbin/dropbear /mnt/sysroot/usr/local/sbin/ [root@centos6 dropbear-2016.73]# which dropbearkey /usr/local/bin/dropbearkey [root@centos6 dropbear-2016.73]# mkdir /mnt/sysroot/usr/local/bin/ -pv mkdir: created directory '/mnt/sysroot/usr/local/bin/' [root@centos6 dropbear-2016.73]# cp /usr/local/bin/dropbearkey /mnt/sysroot/usr/local/bin/ [root@centos6 dropbear-2016.73]# which dbclient /usr/local/bin/dbclient [root@centos6 dropbear-2016.73]# cp /usr/local/bin/dbclient /mnt/sysroot/usr/local/bin/ [root@centos6 dropbear-2016.73]# tree /mnt/sysroot/usr/local/ /mnt/sysroot/usr/local/ ├── bin │ ├── dbclient │ └── dropbearkey └── sbin └── dropbear 2 directories, 3 files
32.建立遠程登陸時,用到的目錄測試
[root@centos6 dropbear-2016.73]# cd /mnt/sysroot/ [root@centos6 sysroot]# mkdir dev/pts [root@centos6 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.爲目標系統生成密鑰文件
[root@centos6 sysroot]# mkdir etc/dropbear [root@centos6 sysroot]# cd etc/dropbear/ [root@centos6 dropbear]# dropbearkey -t rsa -s 2048 -f dropbear_rsa_host_key [root@centos6 dropbear]# dropbearkey -t dss -f dropbear_dss_host_key
34.設置安全的shells
[root@centos6 sysroot]# vim etc/shells /bin/bash /bin/ash /bin/sh /bin/hush /sbin/nologin
35.開啓網絡服務轉換功能
[root@centos6 sysroot]# vim etc/nsswitch.conf passwd:files group:files shadow:files hosts:files dns
36.複製相應的庫文件,路徑要對應,沒有則建立之
[root@centos6 sysroot]# mkdir usr/lib64 [root@centos6 sysroot]# cp -d /lib64/libnss_files* lib64/ [root@centos6 sysroot]# cp -d /usr/lib64/libnss3.so usr/lib64/ [root@centos6 sysroot]# cp -d /usr/lib64/libnssutil3.so usr/lib64/ [root@centos6 sysroot]# cp -d /usr/lib64/libnss_files* usr/lib64/
37.測試
[root@centos6 sysroot]# sync [root@centos6 sysroot]# sync 關閉宿主機 開啓mini Linux 啓動dropbear程序 利用另外一臺Linux 使用ssh登陸到mini Linux