Home

zhangyiqun

Thoughts, stories and ideas.

Research 2014年以前 スーパーマリオ 关于

13 Dec 2009
多个用户如何使用相同UID?

[jean@jeantoe ~]$ pwd

/home/test

[jean@jeantoe ~]$ touch abc

[jean@jeantoe ~]$ ll

total 0

-rw-rw-r– 1 jean jean 0 2009-12-13 21:48 abc

实现方法

# vipw

test:*:500:500::/home/test:/bin/bash

原理解释

uid是不能重复,但是可以多个账户共用一个uid (不违反uid的唯一性)但是身份仅仅是第一个使用uid的那个账户身份

也可以使用useradd来完成。

useradd -o

-o, –non-unique

Allow the creation of a user account with a duplicate (non-unique)

UID.

如何揪出重复UID的用户。我在这里只考虑了有一组UID重复的情况,实际情况复杂时还要作一些调整。

[root@jeantoe mysqla]# grep `awk -F: ‘{print $3}’ /etc/passwd | uniq -c | sort -r | sed ‘1p;d’ | awk ‘{print $2}’` /etc/passwd

Research 2014年以前 スーパーマリオ 关于