6
parrot=`which parrot_run`
10
echo "Use: $0 <identity> [command]";
14
# Clean up the VID so that it can be used in the passwd file.
15
cleanvid=`echo -n "$vid" | tr : _`
17
# Get the current user's real uid and gid
21
# Create a private home directory for this process.
22
mkdir -p /tmp/home.${uid}/$cleanvid
23
HOME=/tmp/home.${uid}/$cleanvid
25
# Create a private passwd file listing only this user.
26
cat > $HOME/.passwd << EOF
27
$cleanvid:x:$uid:$gid:Unknown:$HOME:$SHELL
29
cat /etc/passwd >> $HOME/.passwd
31
cat > $HOME/.group <<EOF
34
cat /etc/group >> $HOME/.group
36
# Create a private ACL so that this user can read and write here.
37
cat > $HOME/.__acl << EOF
41
# If no command was given, run the user's shell in the home dir
42
if [ "X$command" = X ]
48
# Finally, fork off parrot with a private environment and password file.
49
exec /usr/bin/env -i HOME=${HOME} SHELL=${SHELL} LANG=${LANG} TERM=${TERM} ${parrot} -H -M/etc/passwd=${HOME}/.passwd -M/etc/group=${HOME}/.group -u $vid -- $command