User and Permission Management in Linux


 Introduction

Linux is a multi-user operating system, which means multiple people can use the same system at the same time. To maintain security, Linux uses a permission system to control who can read, write, or execute files.


Step 1: Check Current User (whoami)

The whoami command displays the current logged-in user.


whoami


➡️ Example output: oracle or root.


Step 2: Switch Users (su)

The su command lets you switch to another user account.


su - username


➡️ Replace username with the account you want to switch to.


Step 3: File Permissions (ls -l)

Use ls -l to check file permissions.


ls -l


➡️ Example output: -rw-r--r-- 1 user user 1234 Sep 18 file1.txt


r = read


w = write


x = execute


Step 4: Change Permissions (chmod)

The chmod command changes file permissions.


chmod 755 script.sh


➡️ This allows the owner to read/write/execute, and others to read/execute.


Step 5: Change Ownership (chown)

The chown command changes file ownership.


chown oracle:dba file1.txt


➡️ This makes oracle the owner and dba the group.


Conclusion

User and permission management is a key part of Linux security. In the next post, we will cover process management commands to monitor and control running applications.

Comments