Find the files older than 30 days

Find the files that is older than 30 days:
find . -atime +30 -exec stat -c “%n %y” {} \;

Delete the files that is older than 30 days:
find . -atime +30 -print0 | xargs -0 -r rm

Reference: https://stackoverflow.com/a/21451441/126639

Linux Users Management

Show user list
cat /etc/passwd

Show user’s group
id USER_NAME

Add user
adduser USER_NAME

Add group
groupadd GROUP_NAME

Assign user to a primary group (Require re-login to apply the new group)
usermod -g GROUP_NAME USER_NAME

Assign user to a secondary group
usermod -a -G GROUP_NAME USER_NAME

Turn on setgid bit (all new files and subdirectories created within the current directory inherit the group ID of the directory, rather than the primary group ID of the user who created the file)
chmod g+s .

Turn off setgid bit
chmod g-s .

Check if setgid is on
ls .
(If it is on, the group permission will become rws instead of rwx)

Lock Linux Account

Lock an account
usermod –lock –expiredate 1970-01-02 username

Check lock status
sudo passwd -S username