ssfs view ssfs-sh @ rev 52

Add a quick made logo
author Christophe Lincoln <pankso@slitaz.org>
date Sun Jun 12 20:30:25 2011 +0200 (2011-06-12)
parents d1384d21313d
children 217499067412
line source
1 #!/bin/sh
2 #
3 # Ssfs users SHell - Chroot user into the virtual disk on login. This tool must
4 # be installed on the server and in the vdisk chroot, it is executed when logging
5 # in and when chrooting.
6 #
7 # Copyright (C) SliTaz GNU/Linux - BSD License
8 # Author: Christophe Lincoln <pankso@slitaz.org>
9 #
11 # Handle rsync first, user is chrooted after.
12 case "$@" in
13 *rsync*) exec /bin/sh "$@" ;;
14 *help) echo "Usage: $(basename $0) [args]" && exit 0 ;;
15 esac
17 # Ssfs server config doesn't exist in chroot.
18 if [ -f /etc/ssfs/ssfs-server.conf ]; then
19 . /etc/ssfs/ssfs-server.conf
20 root=$SSFS_CHROOT
21 # Make sure it's a valid Ssfs user.
22 [ -d "$root/home/$USER" ] || exit 0
23 exec chroot $root /bin/ssfs-sh "$@"
24 else
25 # Chroot will drop user into /, so set new HOME and cd. Set also
26 # some env variables but don't source any profile.
27 echo -e "\n\033[1m Welcome to the Ssfs SHell $USER\033[0m\n"
28 PS1='\u@\h\e[0m:\e[1;34m\w\e[0m\$ '
29 HOME=/home/$USER
30 SYNC=$HOME/Sync
31 SHELL=/bin/sh
32 export PS1 HOME SYNC SHELL
33 cd $HOME
34 exec /bin/sh "$@"
35 fi