The most important thing about using the terminal is file permission. Often people face trouble when creating a file as sudo and unable to modify as normal user. In ubuntu every file is owned by a particular person or persons. Only he can change the permission for others. He can also set permission for himself.
Execute:
One of the important permission is the execute permission. This sets a particular elemt as a program whether all files without the execute permission is just another data file. For a folder a execute permission in real terms - allows access to the folder elements.
Read:
The read permission sets who can view the file or folder.
Write:
The write permission sets who can control change and even create files or foders.
It isn’t entirely true to say that users won’t be able to view the listing of a folder unless the execute permission is set. If the read permission for a folder is set, but not the execute permission, users will be able to view a short file listing using the ls command but the long listing command option (i.e. ls ‐l myfolder) won’t work. Why this happens is to do
with the way Linux works on a technical level
with the way Linux works on a technical level
To set up a permission one of the following is usually introduce:
Read only: Set the read and execute permission
Write : Set the read write and execute permission
Deny Access: Unset all read write and execute permission.
How permissions look like:
Within a command-line file listing, permissions are indicated by r, for
read, w, for write, and x, for execute. For all files and folders, the
permissions are listed in a line: owner first, followed by group, and then
others
read, w, for write, and x, for execute. For all files and folders, the
permissions are listed in a line: owner first, followed by group, and then
others
ls –l ~
Here’s what I see on my test system:
total 28
drwxr‐xr‐x 2 shabab shabab 4096 2008‐10‐24 10:07 Desktop
drwxr‐xr‐x 2 shabab shabab 4096 2008‐10‐24 10:07 Documents
Let’s take a closer look at the first in the list—the Desktop folder. The
permissions, ownership and group assignment are listed at the
beginning of the line and read as follows:
drwxr‐xr‐x 2 shabab shabab
The d at the beginning simply indicates this is a directory—another
word for a folder. If a hyphen appears there instead then we’re dealing
permissions, ownership and group assignment are listed at the
beginning of the line and read as follows:
drwxr‐xr‐x 2 shabab shabab
The d at the beginning simply indicates this is a directory—another
word for a folder. If a hyphen appears there instead then we’re dealing
Following this are the three sets of permissions, listed one after the
other: rwxr-xr-x which really indicates that -
other: rwxr-xr-x which really indicates that -
Here are the permissions separated out into sets of three relating to
Owner: rwx
Group: r‐x
Others: r‐x
Changing ownership:
Group: r‐x
Others: r‐x
Changing ownership:
The chown command is used to change the ownership. The following command shall change the owner of report.doc to arif
sudo chown arif report.doc
Changing the Permissions:
The chmod command is used to alter permissions. The easiest way to alter the permission is by specifying which file, for whom and what fields of permission. The following example shall explain:
chmod g+w report.doc
In other words, this adds (+) write permissions (w) for report.doc’s
group (g).
If we were feeling generous and wanted to let other users to write to it
too, we could type the following:
chmod o+w report.doc
This adds (+) write (w) permissions for others (o). On the other hand, if we wanted strict secrecy so that only the file’s owner could read or write to the file, and nobody else, we could type the following:
chmod go‐rw report.doc
This removes (‐) read and write permissions (rw) from report.doc for the group and others (go).
No comments:
Post a Comment