Permission and ownership
As a user of a system, to access a file in Linux and UNIX, it is important that a user has the required permission for that specific file or directory. For example, as a regular user, perform cd
into /root
:
$ cd /root bash: cd: /root/: Permission denied
We were not able to do so because of the permission denied error:
$ cd ~/
We were successfully able to do cd
into the user's home directory because a user had the permission to access its own home directory.
Every file in UNIX or Linux has an owner and an associated group. It also has a set of permissions (read, write, and execute) with respect to the user, group, and others.
Viewing the ownership and permission of files
The ls
command with the -l
option is used to view the ...
Get Linux Shell Scripting Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.