Certains de vos utilisateurs ont besoins d'un accès limité au shell. Alors lshell est fait pour vous .

Commencer par récupérer les sources ici ou le .deb. Le .deb est disponible en squeeze ou en sid donc il vous faudra modifier votre source.list en consequence.

  1. /*
  2. deb http://ftp.fr.debian.org/debian/ sid main
  3. apt-get update
  4. apt-get install lshell
  5. */

En mode compilation

  1. /*
  2. tar xzf lshell-0.9.12.tar.gz
  3. cd lshell-0.9.12
  4. python setup.py install --no-compile
  5. */

On crée notre utilisateur

  1. /*
  2. adduser --shell /usr/bin/lshell --home /var/www/usertest/ usertest
  3. */

Maintenant on modifie la conf de lshell

  1. /*
  2. #On autorise une liste de commande
  3. allowed : ['ls','echo','cd','ll','mkdir','rmdir','liste_de_commande']
  4.  
  5. #L'utilisateur ne pourra utiliser des caractéres interdit plus de deux fois ensuite il sera kické
  6. warning_counter : 2
  7. */

Nous pouvons nous connecter avec notre user :

  1. /*
  2. ssh usertest@ip_address
  3. usertest@192.168.10.52's password:
  4. Linux debian-test 2.6.26-2-686 #1 SMP Thu Aug 19 03:44:10 UTC 2010 i686
  5.  
  6. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
  7. permitted by applicable law.
  8. You are in a limited shell.
  9. Type '?' or 'help' to get the list of allowed commands
  10. usertest:~$ ls
  11. usertest:~$ mkdir test
  12. usertest:~$ ls -l
  13. total 4
  14. drwxr-xr-x 2 usertest usertest 4096 aoû 31 13:07 test
  15. */