Understanding Linux File Permissions and Ownerships

From one of our previous articles "How to manage Linux Users and Groups" we discussed on how Linux becomes a multi-user OS, what is a user and a group with their configurations. By design, even though Linux allows multiple users can use the same computer in the same time without affecting others, Linux doesn't allow you to access or modify files belonging to other users. If Linux allows you to do it, that would be a security risk. But somehow they have implemented a security measure to mitigate that security risk. With that we can make sure only desired users and groups can access the relevant files and directories.

If we take a small demonstration. Here, we will log in as a normal user and try to access a root directory.

It gave a permission denied error when accessing. Why ? That's because /root directory is owned by user root. Only a privileged user can access or modify that.

So, Linux introduces two kind of factors which tells who can access or modify a file as w…

Absolute Path and Relative Path

What is an Absolute Path ? 

An absolute path is a fully qualified path. Simply, the path starting from the root "/" and it specifies each an every sub directory  that goes to the destination directory. 

eg : /var/log/messages, /home/student/Videos, /etc/passwd

Like the above, absolute path starts from the root and displays all the directories along to the destination. 

What is a relative Path ? 

Not like absolute Path, relative path shows only the path necessary to reach the file from the present directory (means from the currently working directory). 

eg : Guess the absolute path of a specific file is as below.

Absolute Path : /home/student/Documents/myUrlFiles/linuxschool4you.blogspot.com

And if your present working directory is /home/student/Documents, the relative path for linuxschool4you.blogspot.com is myUrlFiles/linuxschool4you.blogspot.com. 

As a summary,
if my present directory is  /home/student/Documents
So, absolute path and relative path for file linuxschool4you.blogspot.com is as below.

Absolute path - /home/student/Documents/myUrlFiles/linuxschool4you.blogspot.com
Relative path - myUrlFiles/linuxschool4you.blogspot.com


Post a Comment

Popular posts from this blog

Different types of users in linux

Understanding Linux File Permissions and Ownerships

SUDO: What is it in Linux ?