|
useradd -s /bin/zsh -c 'my user' -m anna
|
Create user anna with default shell (-s) and home dir (-m)
|
|
id user
|
Show user info
|
|
groupadd sales
|
Create 'sales' group
|
|
usermod -aG sales anna
|
Add anna to supplementary group 'sales'
|
|
useradd -D
|
Display default value of user
|
|
/etc/default/useradd
|
Configuration file for default value
|
|
/etc/login.defs
|
Additional configuration value
|
|
/etc/skel
|
Content in skel will be copied to new user home dir
|
|
lid -g groupname
|
List all users that are members of a group
|
|
yum groups install 'Directory Client'
|
Install the Utility
|
|
yum install authconfig-gtk
|
Install graphic interface of auth
|
|
/etc/security/limits.conf
|
Limit configuration file:nproc, hard limit, soft limit
|
|
setfacl -R -m d:g:sales:rx account
|
Set ACL so 'sales' group can read, execute on account dir and all sub-dir on default
|
|
getfacl
|
Display all access control list permissions (+ symbol)
|
env (environment variable)
export *var* (store variable)
unset *var* (reset variable)
env -i bash (change environment)
vim /etc/environment (set new variable)
LINUX="/home/long"
source /etc/environement (source new variable w/o reboot)
vim /etc/skel/.bashrc (file for setting)
/etc/skel (putting new file here will make it default for new user only)
|
Read
|
4, Read on File, Ls on Di
|
|
Write
|
2, Modify on File, Create/Del on Dir
|
|
Execute
|
1, Run on File, Cd into Dir
|
|
chgrp account account
|
Change group owner of account dir to 'account' group
|
|
chown anna account
|
Change anna to owner of 'account' dir
|
|
chown linda.sales sales
|
Change user and group owner of 'sales' dir to linda, sales
|
|
chmod g+w account
|
Make members of 'account' group have write permissions on account dir
|
|
chmod 770 sales
|
Make user, group have read, write, execute permission; others none
|
|
chattr +i file1
|
Make file1 has "immutable" attribute
|
|
yum install -y quota
|
Install quota package
|
|
vim /etc/fstab
|
Config file for mounting file system automatically
|
|
mount -o remount /quota
|
Make sure the file system mounted with right options
|
|
quotacheck -mavug
|
Scan the file system
|
|
quota -vu lisa
|
Display quota on user lisa
|
|
quotaon -a
|
Activating quota
|
|
edquota -u lisa
|
Edit quota limit on user lisa; soft to 10; hard to 10
|
|
edquota -b lisa linda
|
Copy the quota limit from lisa to linda
|
|
dd if=/dev/zero of=/quota/bigfile bs=1M count=3
|
if input file; of output file; bs block size; write 3 times
|
|
repquota -aug
|
Display quota overview
|
|
echo password | passwd -stdin brenda
|
Echo password to change brenda's password
|
|
chage brenda
|
Interactive change
|
|
cat /etc/group
|
Group config file
|
|
sales:x:1004:anna
|
GroupName:Password:GroupID:GroupMembers
|
|
cat /etc/passwd
|
User config file
|
|
cat /etc/shadow
|
User Config file
|
|
vipw -s
|
vi passwd consistently
|
|
suio
|
4; run as owner on file
|
|
sgio
|
2; run as group owner on file; inherit dir group owner
|
|
sticky
|
1; delete only if owner on dir
|
|
chmod u+s playme
|
Set UserID bit on playme
|
|
chmod g+s *
|
Set GroupID bit on *
|
|
chmod +t *
|
Apply StickyBit, other users cannot delete file created by owner
|
|
find -perm 0600
|
Find file with read,write for users only
|
|
find / -perm /4000 -exec ls -l {} \;
|
Find files in root dir with userID bit and list it
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.