CNT-2311-Chapter 7 Notes
Linux Usernames
Consist of any combination of upper and lowercase letters, numbers and many punctuation symbols.
User names must begin with a letter and are case sensitive
Usernames may consist of 32 characters but may truncate a username to only 8 characters.
Users
Users are defined not by their name but by a UID (User Id).
First hundred IDs saved for system use.
Useradd
useradd username is the simplest command to add a user.
-c comment parameter passes public information like phone number or real name
-d home-dir specify an accounts home directory
-e YYYY-MM-DD expiration date for the account to be disabled
-f inactive days set the number of day an account is disabled after a password expires
-g default group Set the default group
-G group Adds additional groups, multiple groups can be add with commas.
-s Sets default shell login for the user.
Example
- useradd -d /home4/roger -g project4 -G project1, project4 -s /bin/tcsh sally
- passwd pwnd
Groups
Groups are a collection of accounts mainly for security reasons.
Every file on a Linux system is associated with a specific group and different permissions can be assigned to various members of that group.
Group membership is controlled through /etc/group file.
Each user has a primary group that is set in the /etc/passwd file.
To change from one group to another type newgrp (desired group).