linux command

adduser

Linux Command – adduser ใช้ในการเพิ่ม และจัดการ user บนระบบ

 

คำสั่ง

adduser, addgroup  ตามด้วยชื่อ user ที่ต้องการเพิ่มบนระบบ linux

$ sudo adduser <newuser>

 

โครงสร้างคำสั่ง

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] [--gecosGECOS] user
addgroup [options] [--gid ID] group
addgroup --system [options] [--gid ID] group

 

รายละเอียด

adduser และ addgroup  ใช่สำหรับเพิ่ม, ลด และจัดการข้อมูล user และ group ผ่าน command line ซึ่งจะทำการเขียนข้อมูลลงใน “/etc/adduser.conf” ทำงานลักษณะเดียวกับ useradd, groupadd และ usermod โดยปกติแล้วจะทำการสร้าง home directory พร้อมกับ file ข้อมูลพื่นฐานให้หลังจากเพิ่ม user มีด้วยกัน 5 mode

  • Add a normal user  เป็น default ปกติ
  • Add a system user ใช้ option –system สำหรับ system process ไม่มี shell ให้ login
  • Add a user group ใช้ option –group
  • Add a system group ใช่ command addgroup –system
  • Add an existing user to an existing group

 

OPTIONS

--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 configu?
 ration 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 addi?
 tional 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.

 

กลุ่มคำสั่ง

deluser, useradd, groupadd, usermod

 

Reference:

คำสั่ง Unix – Linux Command

Linux, Unix

 

Author: Suphakit Annoppornchai

Credit: https://saixiii.com

3 Thoughts to “adduser – Linux Command ใช้เพิ่มหรือเปลี่ยนแปลง user บน linux”

  1. […] adduser, chfn(1), chsh(1), passwd(1), crypt(3), groupadd(8), groupdel(8), groupmod(8), login.defs(5), newusers(8), subgid(5), subuid(5), userdel(8), usermod(8) […]

  2. […] adduser, chfn(1), chsh(1), passwd(1), crypt(3), gpasswd(8), groupadd(8), groupdel(8), groupmod(8), login.defs(5), subgid(5), subuid(5), useradd(8), userdel(8). […]

  3. […] adduser, chfn(1), chsh(1), passwd(1), login.defs(5), gpasswd(8), groupadd(8), groupdel(8), groupmod(8), subgid(5), subuid(5), useradd(8), usermod(8). […]

Leave a Reply