← Linux// SCRIPTS

Users & Permissions

How to view user account details in Linux

View a user account entry and password aging with getent passwd and chage -l.

How to see who is logged in and login history in Linux

See current logins with who and w, and login history with last, lastb, and lastlog.

How to read file permissions and ownership in Linux

Read file permissions and ownership with ls -l and stat, and understand the rwx and octal notation.

How to check sudo privileges in Linux

Check what sudo access a user has with sudo -l, and where it is configured in /etc/sudoers and /etc/sudoers.d.

How to create a user in Linux

Create a user account with useradd, set the password, and grant sudo, then verify the account.

How to change a user password and expiry in Linux

Set a user password, force a change at next login, and configure password aging with passwd and chage.

How to manage groups and group membership in Linux

Create groups and add or remove users from them with groupadd, usermod -aG, and gpasswd.

How to change file ownership in Linux

Change the owner and group of files with chown and chgrp, including recursive changes done safely.

How to change file permissions in Linux

Change file permissions with chmod using octal and symbolic modes, including recursive changes done safely.

How to modify, lock, or delete a user in Linux

Lock, unlock, change the shell of, or delete a user account with usermod and userdel.

How to check a user ID and group membership in Linux

Check a user UID, GID, and group memberships with id, groups, and whoami.