- 论坛徽章:
- 0
|
Redhat EL4 下实现ssh chroot 登陆
我的PAM就没起做作用,做了一大堆, 但还是和没改一样的登陆.
mkdir -p /var/chroot
useradd -d /var/chroot carter
chown -R carter:carter chroot
mkdir -p /var/chroot/home/carter
mkdir -p /var/chroot/etc
mkdir -p /var/chroot/bin
mkdir -p /var/chroot/lib
chown -R carter:carter /var/chroot/home/carter
[root@train var]# tail -1 /etc/pam.d/sshd
session required pam_chroot.so
[root@train var]# tail -1 /etc/security/chroot.conf
carter /var/chroot
[root@train var]# /etc/init.d/sshd restart
[root@train var]#cp /bin/bash /var/chroot/bin/
tail -1 /etc/passwd >; /var/chroot/etc/passwd
[root@train var]# ldd /var/chroot/bin/bash
/etc/libcwait.so =>; /etc/libcwait.so (0xb75e7000)
libtermcap.so.2 =>; /lib/libtermcap.so.2 (0xb75d2000)
libdl.so.2 =>; /lib/libdl.so.2 (0xb75cf000)
libc.so.6 =>; /lib/i686/libc.so.6 (0xb7496000)
/lib/ld-linux.so.2 =>; /lib/ld-linux.so.2 (0xb75eb000)
[root@train var]# cp /etc/libcwait.so /var/chroot/etc/
[root@train var]# cp /lib/libtermcap.so.2 /var/chroot/lib/
[root@train var]# cp /lib/ld-linux.so.2 /var/chroot/lib/
[root@train var]# cp /lib/libdl.so.2 /var/chroot/lib/
[root@train var]# mkdir -p /var/chroot/lib/i686
[root@train var]# cp /lib/libc.so.6 /var/chroot/lib/
[root@train var]# echo carter | passwd --stdin carter
Changing password for user carter.
passwd: all authentication tokens updated successfully.
[root@train var]# ssh carter@127.0.0.1
carter@127.0.0.1's password:
[carter@train chroot]$ pwd
/var/chroot
[carter@train chroot]$ ls
bin Desktop etc home lib
这是操作过程, 可是没有任何变化, chroot PAM验证没起作用呀. |
|