knowt logo

User Management, UID, GID

Linux

Linux- is an open-source OS modelled on UNIX/ freely available/ multiuser system

User Management

Multiple users can access the system remotely at once, but need special permissions to access all the data

Accounts can have the following:

• username (or login ID)
• UID (user ID): a unique number
• Default group
• Comments
• Shell
• Home Directory location

/etc/passwd
format of the /etc/passwd:
username : password : UID : GID L comments : home_dir : shell
joe : x : 1000 : 1000 : Joe Henderson : /home/joe : /bin/bash

can see user accounts information
password placement

Verify user: cat /etc/passwd or id yellowtail

$ man passwd

/etc/shadow
Encrypted password used to be stored in /etc/passwd
/etc/passwd is readable by everyone
readable by root
prevents users trying to crack passwords

Root account- always UID 0
System accounts have UIDS < 1000 (1-999)
Standard users start at 1000

Configured in /etc/login.defs
GID
• listed in the /etc/passwd is the default group for an account
• new files belong to a user's default group
• users can switch groups by using newgrp / groupadd command. Mostly use groupadd command
Comment Field
• typically contains the user's full name
• often contains what the account is used for
• may contain additional information like phone numbers
• also call the GECOS field

Shell

• list of available shells are in /etc/shells
• the shell doesn't have to be a shell
• to prevent interactive use of an account, use /usr/sbin/nologin or /bin/false as the shell
• shells can be command line applications

Useradd
Create Password-passwd

Command Structure:
• # passwd [ option ] username
• # passwd grant
Enter new Unix password
Retype new Unix password
Successfully

More options

-g group ( Specify the default or primary group)
-G group1,group2 ( Used for additional groups or Secondary group)
- u (to specify the UID)

Deleting user
userdel

Command structure:
userdel [option] username
-r (recursive

Modifying user
usermod

Command structure:
usermod [option] username

System Accounts

System - application accounts
created for a program that provides a particular service
not created for users to log in
groups - shows the groups a user is in
chage {change age}
allows you to modify account settings relating to account expiration
change -M 90 username
change -m 7 username

su (switch user)
is used to open a shell as another user

to open a login shell

sudo

is a tool that allows an administrator to delegate authority, to give select users (or group) the ability to run some or all the commands as root or another user
used to run tasks as another user
prompts for the password of the current user
authorization through /etc/sudoers /etc/sudoers.d/*

visudo - the command used to make changes to the file.etc.sudoesrs

do not edit this file directly (with text editors)

Wheel group

have sudo privileges by default
easiest way to give privileges to a user is to add them to the "wheel group"

Sudoers file is composed of two entries:

• Aliases (command aliases for example)
• User specifications (decides who can run what)

ctrl + c to get command stripe back
ls -R (shows the directories and what’s in it
ls -R | less (to exit hit the q button)

Every command has a file location

System User
user: name of the user

grep /

ldicaprio1005:1007: Leonardo Dicaprio: /home/ldicaprio: bin
username: password: userid:gid : comment: / home/idicaprio:bin/bash

born against shell (bash)
grep accounting /etc/group

groups obama
obama: obama
name : group it belongs to



useradd -u 1234 dax
tail - #

ctrl y (paste material to terminal
| less ( to see all the groups created
tail (see what commands that were ran at the end
head (see what commands are ran at the beginning

creating a directory and subdirectory at the same time
i.e:
mkdir -p wild/cards

adding multiple members to one group

NJ

User Management, UID, GID

Linux

Linux- is an open-source OS modelled on UNIX/ freely available/ multiuser system

User Management

Multiple users can access the system remotely at once, but need special permissions to access all the data

Accounts can have the following:

• username (or login ID)
• UID (user ID): a unique number
• Default group
• Comments
• Shell
• Home Directory location

/etc/passwd
format of the /etc/passwd:
username : password : UID : GID L comments : home_dir : shell
joe : x : 1000 : 1000 : Joe Henderson : /home/joe : /bin/bash

can see user accounts information
password placement

Verify user: cat /etc/passwd or id yellowtail

$ man passwd

/etc/shadow
Encrypted password used to be stored in /etc/passwd
/etc/passwd is readable by everyone
readable by root
prevents users trying to crack passwords

Root account- always UID 0
System accounts have UIDS < 1000 (1-999)
Standard users start at 1000

Configured in /etc/login.defs
GID
• listed in the /etc/passwd is the default group for an account
• new files belong to a user's default group
• users can switch groups by using newgrp / groupadd command. Mostly use groupadd command
Comment Field
• typically contains the user's full name
• often contains what the account is used for
• may contain additional information like phone numbers
• also call the GECOS field

Shell

• list of available shells are in /etc/shells
• the shell doesn't have to be a shell
• to prevent interactive use of an account, use /usr/sbin/nologin or /bin/false as the shell
• shells can be command line applications

Useradd
Create Password-passwd

Command Structure:
• # passwd [ option ] username
• # passwd grant
Enter new Unix password
Retype new Unix password
Successfully

More options

-g group ( Specify the default or primary group)
-G group1,group2 ( Used for additional groups or Secondary group)
- u (to specify the UID)

Deleting user
userdel

Command structure:
userdel [option] username
-r (recursive

Modifying user
usermod

Command structure:
usermod [option] username

System Accounts

System - application accounts
created for a program that provides a particular service
not created for users to log in
groups - shows the groups a user is in
chage {change age}
allows you to modify account settings relating to account expiration
change -M 90 username
change -m 7 username

su (switch user)
is used to open a shell as another user

to open a login shell

sudo

is a tool that allows an administrator to delegate authority, to give select users (or group) the ability to run some or all the commands as root or another user
used to run tasks as another user
prompts for the password of the current user
authorization through /etc/sudoers /etc/sudoers.d/*

visudo - the command used to make changes to the file.etc.sudoesrs

do not edit this file directly (with text editors)

Wheel group

have sudo privileges by default
easiest way to give privileges to a user is to add them to the "wheel group"

Sudoers file is composed of two entries:

• Aliases (command aliases for example)
• User specifications (decides who can run what)

ctrl + c to get command stripe back
ls -R (shows the directories and what’s in it
ls -R | less (to exit hit the q button)

Every command has a file location

System User
user: name of the user

grep /

ldicaprio1005:1007: Leonardo Dicaprio: /home/ldicaprio: bin
username: password: userid:gid : comment: / home/idicaprio:bin/bash

born against shell (bash)
grep accounting /etc/group

groups obama
obama: obama
name : group it belongs to



useradd -u 1234 dax
tail - #

ctrl y (paste material to terminal
| less ( to see all the groups created
tail (see what commands that were ran at the end
head (see what commands are ran at the beginning

creating a directory and subdirectory at the same time
i.e:
mkdir -p wild/cards

adding multiple members to one group

robot