limit what folder a user can access when using ssh and an editor
Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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?
Distribution: I have multiple Distos available, but I mostly use Ubuntu.
Posts: 47
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.