joh*_*ith 4 users user-management system-installation uid
我遇到了更多的问题,我无法通过更改 UID 来计算。我很沮丧,我只是要格式化并重新开始。这一次,我希望我的安装让第一个用户使用,假设 UID 1200。我不想安装 Ubuntu,然后通过更改我的 UID 来创建所有问题。我不知道如何解决所有这些问题,这就是我格式化的原因。我当然不会再在 Ubuntu 上犯那个错误了。我只想使用特定的 UID 安装 Ubuntu。我该怎么做?
方法 1 - 如果您只想创建具有给定 UID 的用户
sudo adduser -u 1200 <username>awk -F: '/\/home/ {printf "%s:%s\n",$1,$3}' /etc/passwdsudo adduser <username> sudo方法 2 - 使用预置自动安装 Ubuntu
为了能够在安装时定义 UID 范围,您需要使用预置自动安装 Ubuntu,这基本上是
一种设置安装过程中提出的问题的答案的方法,而无需在安装运行时手动输入答案。这使得大多数类型的安装完全自动化成为可能,甚至提供一些在正常安装过程中不可用的功能。
使用这种方法,这是作为这篇文章的一部分广泛发布的方式,您可以(除其他外)设置将在安装时创建的帐户。例子:
# Skip creation of a root account (normal user account will be able to
# use sudo). The default is false; preseed this to true if you want to set
# a root password.
#d-i passwd/root-login boolean false
# Alternatively, to skip creation of a normal user account.
#d-i passwd/make-user boolean false
# Root password, either in clear text
#d-i passwd/root-password password r00tme
#d-i passwd/root-password-again password r00tme
# or encrypted using an MD5 hash.
#d-i passwd/root-password-crypted password [MD5 hash]
# To create a normal user account.
#d-i passwd/user-fullname string Ubuntu User
#d-i passwd/username string ubuntu
# Normal user's password, either in clear text
#d-i passwd/user-password password insecure
#d-i passwd/user-password-again password insecure
# or encrypted using an MD5 hash.
#d-i passwd/user-password-crypted password [MD5 hash]
# Create the first user with the specified UID instead of the default.
#d-i passwd/user-uid string 1010
# The installer will warn about weak passwords. If you are sure you know
# what you're doing and want to override it, uncomment this.
#d-i user-setup/allow-password-weak boolean true
# The user account will be added to some standard initial groups. To
# override that, use this.
#d-i passwd/user-default-groups string audio cdrom video
# Set to true if you want to encrypt the first user's home directory.
d-i user-setup/encrypt-home boolean false
Run Code Online (Sandbox Code Playgroud)
注意这一行:
# Create the first user with the specified UID instead of the default.
d-i passwd/user-uid string 1010
Run Code Online (Sandbox Code Playgroud)
如果您想了解有关自动安装的更多信息,Internet 上有多个有用的信息来源。这是目前的官方文档:
https://help.ubuntu.com/lts/installation-guide/armhf/apbs01.html
| 归档时间: |
|
| 查看次数: |
9262 次 |
| 最近记录: |