-   Linux - Security (
-   -   limit what folder a user can access when using ssh and an editor (

PhloxLot 08-02-2009 09:00 PM

limit what folder a user can access when using ssh and an editor
I have a jail setup on a server where my students logon using ssh and they program using vim. My jail setup currently allows them to only work in the directory /home/jail/home/username and only issue select shell commands. I would like to extend the use of an editor or IDE but I don't know how to prevent them from going "up-stream"(outside of their own folder) when they do a file-->open, or edit or save from the editor.

When they open an editor from their ssh terminal window, are they opening a child process or an completely independent process? If they are opening a child process, I have a script that filters their commands and limits what they can do. I would think that I could filter commands issued from the editor within this script. Correct? If not, how would I do it?

Meson 08-03-2009 02:08 AM

I've never worked with chroot but I'll at least say that AFAIK, if the user is properly jailed, and runs vi, vi should only be able to access files in the jail. anything in a higher directory simply shouldn't exist.

scheidel21 08-03-2009 08:32 AM

Anything spawned from the ssh session should be a child process of that SSH session, if you were to look at it in pstreee you would see that. However, how are you going to run the IDE is it a test based IDE or GUI based, if GUI based how are you going to run that?

tuxhats 08-03-2009 04:21 PM

pstrace or strace may be what you need to use in some matter. I'm not sure how to implement this should a user, from a shell enter say, gedit. Can it capture say "File Open" and return the users home directory as the highest file level they can see? Perhaps someone in the forum we have here called "Non-*NIX" under "Programming" might be of help.

All times are GMT -5. The time now is 02:00 PM.