Chinaunix

标题: 如何让一个用户看不到其他用户 [打印本页]

作者: xlmeng1988    时间: 2016-06-14 16:35
标题: 如何让一个用户看不到其他用户
请问:如何新建一个用户,该用户不能看见其他用户,即不能看见/home/下的其他用户的目录?
作者: action08    时间: 2016-06-14 16:35
本帖最后由 action08 于 2016-06-14 21:56 编辑

你的需求足够挑剔,目前linux默认机制是不提供你的需求的,即使是号称高强度的安全linux也没有这样的机制
linux默认还提供一种多用户机制,查看当期计算机登录的用户
  1. shell@localhost:~$ w
  2. 21:54:22 up 34 min,  2 users,  load average: 3.32, 3.32, 2.98
  3. USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
  4. shell    tty7     :0               21:20   34:40   2:43   0.09s /bin/sh /etc/xd
  5. shell    pts/0    :0.0             21:54    2.00s  0.08s  0.01s w
  6. shell@localhost:~$ w
  7. 21:55:26 up 35 min,  3 users,  load average: 3.12, 3.25, 2.98
  8. USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
  9. shell    tty7     :0               21:20   35:44   2:47   0.09s /bin/sh /etc/xd
  10. shell    pts/0    :0.0             21:54    1.00s  0.09s  0.01s w
  11. root     tty3     -                21:55    6.00s  0.16s  0.09s -bash
  12. shell@localhost:~$
  13. shell@localhost:~$
复制代码
而且这些还依赖很多条件,比如linux是否存在漏洞等等等。既然你提到了小学生,那么就应该假设小学生不会拥有机器的root权限。


目前有一个比较稳妥的办法不知道你是否考虑,而且也很简单,
装个虚拟机,专门给guest使用

作者: _bbb    时间: 2016-06-14 16:44
(1)把把其他用户都放在一个groupA,并且设置 /home 只允许groupA访问
(2)修改这个user1的 home directory,把user1从 groupA 排除在外

请问楼主,为什么会有这样的要求?user1 能看到/home下面的目录,但是进不去就可以了
作者: jixuuse    时间: 2016-06-14 16:51
要创建一个超级后门用户么?

最简单的就是修改home目录,丢到别人想不到的路径下即可
作者: xlmeng1988    时间: 2016-06-14 17:09
回复 2# _bbb


1. 就是有这么个需求,想创建一个类似Guest的用户,但是又不想让他看见系统已有的用户……
2. 如何设置/home只对个别组可见?好像还得设置别的才能完全不可见其他用户吧。。。。

作者: xlmeng1988    时间: 2016-06-14 17:10
回复 3# jixuuse


    有人就是有这样的需求…………
作者: jixuuse    时间: 2016-06-14 17:16
xlmeng1988 发表于 2016-06-14 17:10
回复 3# jixuuse



其实,大隐隐于市

创建一个普通用户,然后加入sudo,给ALL权限,这样和root有何区别?别人还看不出来
作者: xlmeng1988    时间: 2016-06-14 18:12
jixuuse 发表于 2016-06-14 17:16
其实,大隐隐于市

创建一个普通用户,然后加入sudo,给ALL权限,这样和root有何区别?别人还看不出 ...


跑偏了,我不是要弄一个超级后门。
打个比方,是给一个小学生留个门让他进来吃顿饭,但有不想让他知道这个屋(home)里都有哪些人……
作者: action08    时间: 2016-06-14 22:06
本帖最后由 action08 于 2016-06-14 22:07 编辑

回复 3# jixuuse
  1. debian > man useradd
复制代码
useradd -D [options]

DESCRIPTION
       useradd is a low level utility for adding users. On Debian,
       administrators should usually use adduser( instead.

       When invoked without the -D option, the useradd command creates a new
       user account using the values specified on the command line plus the
       default values from the system. Depending on command line options, the
       useradd command will update system files and may also create the new
       user's home directory and copy initial files.

       By default, a group will also be created for the new user (see -g, -N,
       -U, and USERGROUPS_ENAB).

OPTIONS
       The options which apply to the useradd command are:

       -b, --base-dir BASE_DIR
           The default base directory for the system if -d HOME_DIR is not
           specified.  BASE_DIR is concatenated with the account name to
...................
作者: xlmeng1988    时间: 2016-06-15 11:09
回复 8# action08

非常感谢!!!
目前能想到的也就是装个虚拟机创建Guest用户了。


   
作者: 我不哭想    时间: 2016-06-15 21:50
看看了。。。。。。。。。。。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2