ssfs view ssfs-sh @ rev 34

Samlls improvment to server tool Shell
author Christophe Lincoln <pankso@slitaz.org>
date Sun Jun 12 13:31:26 2011 +0200 (2011-06-12)
parents 95b88686a283
children 9b2eacb4078b
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 #
8 # Ssfs server config doesn't exist in chroot.
9 if [ -f /etc/ssfs/ssfs-server.conf ]; then
10 . /etc/ssfs/ssfs-server.conf
11 root=$SSFS_CHROOT
12 # Make sure it's a valid Ssfs user.
13 [ -d "$root/home/$USER" ] || exit 0
14 clear && exec chroot $root /bin/ssfs-sh
15 else
16 # Chroot will drop user into /, so set new HOME and cd. Set also
17 # some env variables but don't source any profile.
18 echo -e "\nWelcome to the Ssfs SHell $USER\n"
19 HOME=/home/$USER
20 SYNC=$HOME/Sync
21 SHELL=/bin/sh
22 PS1="$USER@ssfs:\w$ "
23 export HOME SYNC SHELL PS1
24 cd $HOME && exec /bin/sh $@
25 fi