简体   繁体   English

如何监禁linux用户

[英]How to jail linux user

Is there something similar to chroot, but for users? 是否有类似于chroot的东西,但对于用户?

We are about to grant access to our servers for a client and would like them to see only the directories we allow. 我们即将授予客户端访问服务器的权限,并希望他们只查看我们允许的目录。

A Google search on "openssh jail" led me to SSHjail for openSSH . 谷歌搜索“openssh jail”让我进入了openjSH的SSHjail If your client uses ssh/scp to access the said servers, this might be what you are looking for. 如果您的客户端使用ssh / scp访问所述服务器,那么这可能就是您要查找的内容。

The "best answer" from 2009 is outdated. 2009年的“最佳答案”已经过时。 OpenSSH now comes with the ChrootDirectory option. OpenSSH现在带有ChrootDirectory选项。 See http://www.debian-administration.org/articles/590 which is for an already-old version of ssh. 请参阅http://www.debian-administration.org/articles/590 ,该版本适用于已有旧版本的ssh。

It is important to note that chroot(2) is not meant for security purposes. 重要的是要注意chroot(2)不是出于安全目的。 It is incredibly easy to escape a chroot jail. 逃离chroot监狱非常容易。 See this article on abusing chroot for more information. 有关更多信息,请参阅有关滥用chroot的文章。

一个有效的方法是使用lshell

如果你真的想要达到这个极端, SE Linux (或任何其他强制访问控制 )是默认的unix权限的明确改进。

No easy way to jail users in their homedirs. 没有简单的方法可以在他们的家中监禁用户。 BTW, I would NEVER give access to my systems to someone I don't trust a minimum. 顺便说一下,我永远不会让我的系统访问我不信任的人。

Last time I did, I used an "unescapable" menu based on http://bash.cyberciti.biz/guide/A_menu_box The .bashrc launches this script you would not escape : 上次我做了,我使用了一个基于http://bash.cyberciti.biz/guide/A_menu_box的“不可避免”菜单.bashrc启动你不会逃避的这个脚本:

~/.bashrc :
(LAST LINE)
./menu.sh; exit 0

Yes, I had to write scripts for each and every menu item (get logs, check sys, ...) but nobody to run 'chown -R root:root /' instead of *. 是的,我必须为每个菜单项编写脚本(获取日志,检查sys,...)但是没有人运行'chown -R root:root /'而不是*。 Priceless. 无价。

[EDIT] : create a dedicated user, don't do this as root !!! [编辑]:创建一个专用用户,不要以root身份执行此操作!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM