HI ,
I am trying to setup chrooted environment on RHEL4, for squid proxy.
I have copied the required libraries and stuff for chroot. Used the below for chroot-shell .
user is squid
[root@CHROOT-TEST ~]# grep squid /etc/passwd
squid:x:500:501::/opt/squid:/bin/chroot-shell
directory trying to jail is /opt; user entry in chrooted environment
[root@CHROOT-TEST squid]# grep squid /opt/squid/etc/passwd
squid:x:500:501::/opt:/bin/bash
[root@CHROOT-TEST ~]# more /bin/chroot-shell
#! /bin/bash
if [ "$1" = "-c" ]; then
sudo /usr/sbin/chroot /opt/$USER /bin/su - $USER $*
else
sudo /usr/sbin/chroot /opt/$USER /bin/su - $USER
fi
[root@CHROOT-TEST ~]#
/etc/sudoers entry for sudo access.
squid ALL=NOPASSWD: /usr/sbin/chroot /opt/squid /bin/su - squid
Now when I login as root[super user] and try to switch to squid user it fails.
[root@CHROOT-TEST ~]# su - squid
/bin/su: incorrect password
[root@CHROOT-TEST ~]#
Even when I try to login directly as a squid user, terminal vanishes. Seems confusing.
Would gr8ly apprecaite if someone can help me in this....