user_id 和 group_id 始终从唯一值开始

发布于 2024-12-11 02:34:31 字数 642 浏览 2 评论 0原文

当我在 Linux 中使用 useradd 命令时,该帐户的 user_idgroup_id 会自动选择为 500。现在,如果我删除该帐户并创建再一次,那么user_id和group_id也是500。这个默认值是从哪里选择的?

我使用了这个命令:

$ useradd ping
password:

然后查看了以下文件

$ cat /etc/group /etc/passwd 

root::0:root
tty::5:
disk:x:100:
floppy:x:101:
uucp:x:102:
utmp:x:103:
lp:x:104:
kmem:x:105:
vcsa:x:106:
sshd:x:74:
ping:x:500:

root:x:0:0:root:/root:/bin/bash
nobody:x:99:99:Nobody:/:/sbin/nologin
vcsa:x:106:106:vcsa privsep:/var/empty:/sbin/false
sshd:x:74:74:sshd privsep:/var/empty:/sbin/false
ping:x:500:500::/home/ping:/bin/bash

When i used useradd command in linux, the user_id and group_id for the account is automatically chosen as 500. Now if i delete the account and create it again, then also the user_id and group_id is 500. From where is this default value chosen ?

I used this command :

$ useradd ping
password:

and then looked into the following file

$ cat /etc/group /etc/passwd 

root::0:root
tty::5:
disk:x:100:
floppy:x:101:
uucp:x:102:
utmp:x:103:
lp:x:104:
kmem:x:105:
vcsa:x:106:
sshd:x:74:
ping:x:500:

root:x:0:0:root:/root:/bin/bash
nobody:x:99:99:Nobody:/:/sbin/nologin
vcsa:x:106:106:vcsa privsep:/var/empty:/sbin/false
sshd:x:74:74:sshd privsep:/var/empty:/sbin/false
ping:x:500:500::/home/ping:/bin/bash

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月朦胧 2024-12-18 02:34:31

默认值取决于您运行的 Linux 发行版。

我的 debian 盒子在 /etc/login.defs 文件中设置了 UID_MIN 1000

如果您的目标是使用不同的 UID,那么您需要使用 -u | useradd 的 --uid 选项。

The defaults are dependent upon the linux distribution you're running.

My debian box has UID_MIN 1000 set in the /etc/login.defs file.

If your goal is to use a different UID, then you need to use the -u | --uid option for useradd.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文