ssfs diff ssfs-sh @ rev 29

Add ssfs-sh - Ssfs SHell for chrooted users with minimal env vars, also needed since chroot drop user to / by default
author Christophe Lincoln <pankso@slitaz.org>
date Sun Jun 12 09:49:52 2011 +0200 (2011-06-12)
parents
children 95b88686a283
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ssfs-sh	Sun Jun 12 09:49:52 2011 +0200
     1.3 @@ -0,0 +1,25 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# Ssfs users SHell - Chroot user into the virtual disk on login. This tool must
     1.7 +# be installed on server and in the vdisk chroot, it is executed when login and
     1.8 +# when chrooting.
     1.9 +#
    1.10 +
    1.11 +# Ssfs server config dont exist in chroot.
    1.12 +if [ -f /etc/ssfs/ssfs-server.conf ]; then
    1.13 +	. /etc/ssfs/ssfs-server.conf
    1.14 +	root=$SSFS_CHROOT
    1.15 +	# Make sure it's a valid Ssfs user.
    1.16 +	[ -d "$root/home/$USER" ] || exit 0
    1.17 +	clear && exec chroot $root /bin/ssfs-sh
    1.18 +else
    1.19 +	# Chroot will drop user into /, so set new HOME and cd. Set also
    1.20 +	# some env variables but dont source any profile.
    1.21 +	echo -e "\nWelcome to Ssfs SHell $USER\n"
    1.22 +	HOME=/home/$USER
    1.23 +	SYNC=$HOME/Sync
    1.24 +	SHELL=/bin/sh
    1.25 +	PS1='\u@ssfs:\e[1;33m\w\e[0m\$ '
    1.26 +	export HOME SYNC SHELL PS1
    1.27 +	cd $HOME && exec /bin/sh $@
    1.28 +fi