Unix File and Directory Permissions

Let's examine the output from the ls –l command. For example, type the following:

					>ls -l
					-rw-r--r-- 1 rob  rob     2024 Dec 25 20:22 39 atest.tar
					-rwxrwxr-x 5 rob  rob     1024 Dec 25 20:22 atest2.tar
					...
				

When considering file and directories, you have to understand the concept of ownership. Ownership is nothing more than noting who owns the file. Each file has information stored with it that identifies the account that owns it. From the example of ls –l, you can see that I am the owner of the two files in my current directory: atest.tar and atest2.tar. Files are owned by those who create them, although ownership can be transferred.

Each file on the Unix system also has a secondary piece of information stored that records the group ownership of the file.

What Is a Group? The definition of a group is not very complex, but the application of it is. Groups are collections of users. By allowing a group to share ownership of files, many people can work together on a project and have their changes immediately available to other members of the group. Creation of groups is a system administration task, so if you need a group created for a project, talk to your system administrator.


Permissions, once applied, will control what a user (or group) can do to a file or directory. There are three basic actions, which are self-explanatory: read, write, and execute. We have already spent time covering what executables are earlier in the book. If you do not have the permissions such as read, write, or execute, then you will not be able to work with the files. It's really that simple.

  • Read permissions control whether someone can view a file.

  • Write allows or disallows changes to be made to a file.

  • Execute permissions control whether a file can be run, or executed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.69.119