Red Hat Linux Fedora For Dummies [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Red Hat Linux Fedora For Dummies [Electronic resources] - نسخه متنی

Jon Hall

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید






Making Your Own Rules


You, as the owner of a file, can specify permissions for reading, writing to, or executing a file. You can also determine who (yourself, a group of people, or everyone in general) can do these actions on a file. What do these permissions mean? Read on (you have our permission):



Read permission: You can read the file. For a directory, read permission allows the ls command to list the names of the files in the directory. You must also have execute permission for the directory name to use the -l option of the ls command or to change to that directory.



Write permission: You can modify the file. For a directory, you can create or delete files inside that directory.



Execute permission: You can type the name of the file and execute it. You can’t view or copy the file unless you also have read permission. Files containing executable Linux commands, called shell scripts, must therefore be both executable and readable by the person executing them. Programs written in a compiled language, such as C, however, must have only executable permissions, to protect them from being copied where they shouldn’t be copied.

For a directory, execute permission means that you can change to that directory (with cd). Unless you also have read permission for the directory, ls -l doesn’t work. You can list directories and files in that directory, but you can’t see additional information about the files or directories by using just an ls -l command. This arrangement may seem strange, but it’s useful for security.



The first character of a file permission is a hyphen (-) if it’s a file; the first character of a directory is d. The nine other characters are read, write, and execute positions for each of the three categories of file permissions:



Owner (also known as the user)



Group



Others



Your gotowork file, for example, may show these permissions when listed with the ls -l gotowork command:

-rw-rw-r--

The hyphen (-) in the first position indicates that it’s a regular file (not a directory or other special file). The next characters (rw-) are the owner’s permissions. The owner can read and write to the file, but can’t execute it.

The next three characters (rw-) are the group’s permissions. The group also has read-write access to the file. The last three characters (r--) are the others’ permissions, which are read-only.

[-][rw-][rw-][r--] illustrates the four parts of the permissions: the file type followed by three sets of triplets, indicating the read, write, and execute permissions for the owner, group, and other users of the file (meaning everyone else).

You can specify most file permissions by using only six letters:



ugo stands for — no, not a car — user (or owner), group, and other.



rwx stands for read, write, and execute.



These six letters, and some symbols, such as the equal sign (=) and commas, are put together into a specification of how you want to set the file’s permissions.

The command for changing permissions is chmod. Here’s its syntax:

chmod specification filename

Change the mode of gotowork to give users the ability to read, write, and execute a file:

chmod u=rwx gotowork

That was easy enough. What if you want to give the group permission to only read and execute the file? You execute this command:

chmod g=rx gotowork

This command doesn’t affect the permissions for owner or other — just the group’s permissions. You can set the permission bits in other ways. But because this way is so simple, why use any other?

/ 194