Linux File System Permissions: LinuxLookup
Submitted by charlie.collins on Sun, 07/09/2000 - 08:37
Tagged:
Yet another Linux site, man, the plethora continues to grow. LinuxLookup is a very nice site, good content and nice look and feel (I will look for the backend and try to provide the LinuxLookup syndication link on ToTSP, keep posted.) I saw this story come across LinuxToday and thought I would relate it because it is indeed true that file permissions are on of the most bewildering things for Linux newbies.
This is a reprint direct from LinuxLookup (check them out too!)
Ownership & Permissions Guide
Written by Ty ( ty@linuxlookup.com )
v1.0, July 4, 2000
_________________________________________________________
TABLE OF CONTENTS
1. Introduction
- 1.1 Copyright & Disclaimer
- 1.2 Synopsis
- 2.1 What is Chmod?
- 2.2 Permissions & Values
- 2.3 Chmod Usage
- 3.1 What is Chown?
- 3.2 Chown Usage
Letter Meaning r Read w Write x ExecuteEach permission has a corresponding value. Seen here:
Read = 4 Write = 2 Execute = 1When you combine attributes, you add their value.
Permission Values Meaning --- 0 No permissions r-- 4 Read only rw- 6 Read and Write rwx 7 Read, Write and Execute r-x 5 Read and Execute --x 1 ExecuteSure other combinations exist, but this is all you'll need (I hope). When you combine these values, you get three numbers that make up the files the files permissions. Here are some examples: Permission Values Meaning -rw------- 600 The owner has read and write permissions. Nobody else has privileges.This is what you'll want to set for the majority of your files. -rw-r--r-- 644 The owner has read and write permissions. The group and world has read only permissions. Use this when you're sure you want to let others read this file. -rw-rw-rw- 666 *THIS IS BAD* Everybody has read and write permissions.You don't want people to be allowed to change your files. -rwx------ 700 The owner has read, write and execute permissions. This is what you'd use for programs you'll want to run. -rwxr-xr-x 755 The owner has read, write and execute permissions. The group and rest of the world have read and execute. -rwxrwxrwx 777 *THIS IS BAD* Everyone has read, write and execute permissions.Allowing people to edit your files is just asking for trouble. -rwx--x--x 711 The owner has read, write and execute permissions.The group and the rest of the world have execute only permissions.This is perfect for letting others run programs, but not copy. drwx------ 700 This is a directory. Only the owner can read and write to it. (Note: All directories must have an executable bit set) drwxr-xr-x 755 This directory can be changed only by the owner, but everyone else can view it's contents. drwx--x--x 711 This is perfect for when you need to keep a directory world readable, but you don't want people being able to view it's content. Only if they know the file name they're looking for will they be allowed to read it. 2.3 Chmod Usage Now that I've shown you some of the permissions, learning chmod is easy. To change the permissions on a file, log in as root and then enter the following:
[root@linuxlookup /root]# chmod permissions filenameWhere permissions is a numeric value (three(3) digits which can be seen above) and file is the name of the file for which you want to affect. For example, to set the ty.html file to be read and writeable by the owner, but only want to allow the group and world read access, the command would be:
[root@linuxlookup /root]# chmod 644 ty.htmlTo recursively change the permissions on all the files in a specific directory, use the -R option in the command. For example, to male all the files on /home/ty/html set to the permission 755, you would:
[root@linuxlookup /root]# chmod -R 755 /home/ty/html_________________________________________________________ 3. The Chown Command 3.1 What is Chown? Chown is pretty straightforward. It allows you to change ownership. It's also used in conjunction with Chmod, as you should know by the time you're done reading this guide. 3.2 Chown Usage To change the owner of a file, you must use the chown command. Log in as root and enter the following:
[root@linuxlookup /root]# chown ownername filenameWhere ownername is the login name of the user you want to change the file's owner setting to, and filename is the name of the file for which you want the owner changed. For example, if you wanted to change the owner for the file index.html to ty, you would use chown as follows:
[root@linuxlookup /root]# chown ty index.htmlTo change the owner of a directory and all its subdirectories and files, you can use the chown command with the -R option. For example, to change the owner on all the files in the my-stuff directory to ty, you would use:
[root@linuxlookup /root]# chown -R ty my-stuffAnother option of chown allows you to change the group of a file by:
[root@linuxlookup /root]# chown user.group filenameExample:
[root@linuxlookup /root]# chown root.root public_html/Linux File System Permissions: LinuxLookup







Recent comments
22 weeks 2 days ago
22 weeks 2 days ago
24 weeks 6 days ago
25 weeks 4 days ago
25 weeks 4 days ago
25 weeks 4 days ago
30 weeks 1 day ago
30 weeks 2 days ago
30 weeks 5 days ago
31 weeks 6 hours ago