This document discusses managing local Linux users and groups. It explains that every process runs as a user, and every file is owned by a user. It describes how to view user and process information using the ls, ps, and su commands. It also discusses how user and group information is stored in /etc/passwd and /etc/group files. It provides instructions for adding and deleting users and groups using the useradd, userdel, groupadd, and groupdel commands. It also covers setting passwords using passwd and modifying group membership using usermod.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
28 views20 pages
Linux
This document discusses managing local Linux users and groups. It explains that every process runs as a user, and every file is owned by a user. It describes how to view user and process information using the ls, ps, and su commands. It also discusses how user and group information is stored in /etc/passwd and /etc/group files. It provides instructions for adding and deleting users and groups using the useradd, userdel, groupadd, and groupdel commands. It also covers setting passwords using passwd and modifying group membership using usermod.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20
MANAGING LOCAL LINUX
USERS AND GROUPS
What is user • Every process (running program) on the system runs as a particular user. • Every file is owned by a particular user. Access to files and directories are restricted by user. • The user associated with a running process determines the files and directories accessible to that • To view the user associated with a file or directory, use the ls -l command. • To view process information, use the ps command. The default is to show only processes in the current shell. • Add the a option to view all processes with a terminal. • To view the user associated with a process, include the u option. • By default, systems use a simple "flat file," the /etc/passwd file, to store information about local users. What is a group? • Like users, groups have a name and a number (GID). • Local groups are defined in /etc/group Primary groups • Every user has exactly one primary group. • For local users, the primary group is defined by the GID number of the group listed in the fourth field of /etc/passwd. • Normally, the primary group owns new files created by the user. • Normally, the primary group of a newly created user is a newly created group with the same name as the user. The user is the only member of this User Private Group (UPG). Supplementary groups • Users may be a member of zero or more supplementary groups. • The users that are supplementary members of local groups are listed in the last field of the group's entry in /etc/group. For local groups, user membership is determined by a commaseparated list of users found in the last field of the group's entry in /etc/group Switching users with su • The su command allows a user to switch to a different user account. If a username is not specified, the root account is implied. When invoked as a regular user, a prompt will display asking for the password of the account you are switching to; when invoked as root, there is no need to enter the account password. useradd creates users • useradd username sets reasonable defaults for all fields in /etc/passwd when run without options. • The useradd command does not set any valid password by default, and the user cannot log in until a password is set. userdel deletes users • userdel username removes the user from /etc/passwd, but leaves the home directory intact by default. • userdel -r username removes the user and the user's home directory. passwd sets passwords • passwd username can be used to either set the user's initial password or change that user’s password. • The root user can set a password to any value. A message will be displayed if the password does not meet the minimum recommended criteria, but is followed by a prompt to retype the new password and all tokens are updated successfully. UID ranges • UID 0 is always assigned to the superuser account, root. • UID 1-200 is a range of "system users" assigned statically to system processes by Red Hat. • UID 201-999 is a range of "system users" used by system processes that do not own files on the file system. They are typically assigned dynamically from the available pool when the software that needs them is installed. Programs run as these "unprivileged" system users in order to limit their access to just the resources they need to function. • UID 1000+ is the range available for assignment to regular users Practice • Add user Managing Local Group Accounts • groupadd groupname without options uses the next available GID from the range specified in the /etc/login.defs file.
• The -g GID option is used to specify a specific GID.
• The groupdel command will remove a group. usermod alters group membership Practice • Managing Group Laporan Resmi Pertemuan 4 • Buat User dari Nama Lengkap masing-masing (jumlah user sesuai nama lengkap) • Buat Grup SOLanjut dan BE171 • Bagi user kedalam 2 grup tersebut, jumlah user tiap grup bebas • Tampilkan 6 data terakhir dari /etc/passwd • Tampilkan 6 data terakhir dari /etc/group • Tampilkan ID dari user pada masing-masing grup • SS dan upload dalam bentuk pdf ke elearning