chroot alternative

僤鯓⒐⒋嵵緔 提交于 2019-12-12 20:26:19

问题


I'm working on a webapp (running on an Ubuntu server) that will allow the user to run Octave code (basically Matlab). However, I only want them to be able to read or modify folders in their designated home folder.

I know chroot is one way of doing this, but it's insecure and you need root privileges to chroot (which ideally the app won't need).

Also, I could read the user's code before running and throw an error if they try to write to a file, but for that I'd need to think of EVERY way the user might break my rules in order to prevent it.

I've looked at Linux-VServer but that would require a separate virtual server for each user (unless I'm mistaken).

edit: I could set up an SSH connection and jail the connection, but that seems unnecessarily resource-greedy.

Is there a way I could jail a user or process to a particular folder without using chroot?


回答1:


Check out lxc.

http://lxc.sourceforge.net/

LXC is... "LXC is the userspace control package for Linux Containers." It's kind of like a cgroups virtualization.




回答2:


You could use Coffer which is pretty much a pretty wrapper around chroot. It does a lot of the heavy lifting for you.

https://github.com/Max00355/Coffer



来源:https://stackoverflow.com/questions/15670387/chroot-alternative

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!