Lab-5a-Users and Groups
Linux: Config files related to users and groups
Three important files
# cat /etc/passwd [users ID is save here and root ID is 0]
# cat /etc/shadow [ contains user password (hashed)]
# cat /etc/group [group information saved in this file]
Add User
Create user called "Peter"
# useradd -c "Peter Janson" -s /bin /zsh peter
# passwd peter
Check what's inside Peter's Home directory
# ls /home/peter/
# ls -la /home/peter
Note
ls -la /etc/skel/
files are copied from here to users profile created. If this file modified - creating new users will get all the modified directories upon creating the new user.
Create a user with specific user ID
Example - user Brian with user ID 200
# usradd -c "Brian Janson" - u 200 -g users -s/bin/bash brain
# passwd brian [create passwd for Brian]
ssh to the machine
# ssh brian@localhost
Login
# id //displays user id//
Configruing groups and assigning users to groups
Create groups called "family"
# groupadd family
Error msg might display if not root user. Switch to root
#su -
# group family
# usrmod -G family brian [braian user is added to group family