在 Cubic 中,如何自定义 Xubuntu 22.04 Live USB/iso 以拥有默认用户?最终目标是:
- 安装期间不提示输入用户名/密码,而是只使用我提供的默认用户名/密码。
- 设置用户自动登录
- 如果“实时”用户仍然是 ubuntu,我不介意,但安装的主用户名应该是我设置的。
我更喜欢可以在 chroot 中执行的解决方案(因为我有一个可以自动进行一系列其他定制的脚本)。
答案1
adduser
您可以通过在立方终端屏幕中应用命令来添加用户
adduser username #replace username by your user name
adduser [options] [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID] [--firstuid
ID] [--lastuid ID] [--ingroup GROUP | --gid ID] [--disabled-password] [--disabled-login]
[--gecos GECOS] [--add_extra_groups] [--encrypt-home] user
adduser --system [options] [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID]
[--group | --ingroup GROUP | --gid ID] [--disabled-password] [--disabled-login] [--gecos
GECOS] username
选项
--conf FILE
Use FILE instead of /etc/adduser.conf.
--disabled-login
Do not run passwd to set the password. The user won't be able to use her account
until the password is set.
--disabled-password
Like --disabled-login, but logins are still possible (for example using SSH RSA
keys) but not using password authentication.
--force-badname
By default, user and group names are checked against the configurable regular
expression NAME_REGEX (or NAME_REGEX_SYSTEM if --system is specified) specified in
the configuration file. This option forces adduser and addgroup to apply only a
weak check for validity of the name.
--gecos GECOS
Set the gecos field for the new entry generated. adduser will not ask for finger
information if this option is given.
--gid ID
When creating a group, this option forces the new groupid to be the given number.
When creating a user, this option will put the user in that group.
--group
When combined with --system, a group with the same name and ID as the system user
is created. If not combined with --system, a group with the given name is created.
This is the default action if the program is invoked as addgroup.
--help Display brief instructions.
--home DIR
Use DIR as the user's home directory, rather than the default specified by the
configuration file. If the directory does not exist, it is created and skeleton
files are copied.
--shell SHELL
Use SHELL as the user's login shell, rather than the default specified by the
configuration file.
--ingroup GROUP
Add the new user to GROUP instead of a usergroup or the default group defined by
USERS_GID in the configuration file. This affects the users primary group. To add
additional groups, see the add_extra_groups option
--no-create-home
Do not create the home directory, even if it doesn't exist.
--quiet
Suppress informational messages, only show warnings and errors.
--debug
Be verbose, most useful if you want to nail down a problem with adduser.
--system
Create a system user or group.
--uid ID
Force the new userid to be the given number. adduser will fail if the userid is
already taken.
--firstuid ID
Override the first uid in the range that the uid is chosen from (overrides
FIRST_UID specified in the configuration file).
--lastuid ID
Override the last uid in the range that the uid is chosen from ( LAST_UID )
--add_extra_groups
Add new user to extra groups defined in the configuration file.
--version
Display version and copyright information
答案2
我找到了如何做到这一点的方法。在 Cubic 中,在最后一个有预置选项的屏幕上,添加以下几行:
d-i passwd/user-fullname string yourusernamehere
d-i passwd/username string yourusernamehere