How Do I Change File Permissions in Linux?Hardware: Serial
Problem: How do I check and change the permissions of my files in Linux? Solution: On a normal file there are three permission attributes: read (r), write (w), and execute (x). The read permission lets you read data from the file. The write permission lets you write new data to the file. The execute permission lets you run the file as a program. To check the permissions, use the ls -l command. This command will return a list of all of the filenames and their permissions in the current directory. The beginning of each line will be a string of letters and dashes that tells you the permissions for that file. For example, after you run the ls -l command, you will see text that is similar to the following line: rwxr-xr-x 2 owner group 15236 May 2 15:20 FileName The first set of 3 letters indicates permissions for the owner, which is the first name listed (owner). The second set of 3 letters indicates the permissions for the group (group). The third set of letters represents the permissions for everyone else. The example line above would indicate that owner has read, write, and execute access, while the group and everyone else have only read and execute access. To change the file permissions, you must have privileges to write to the file (as you are making changes to the file). The command to change permissions is chmod. With chmod, you need to specify three items: the user or group you are changing, whether you are adding or removing privileges, and which privileges you are adding/removing. First, you specify the user or group with the following letters: user (u), group (g), or all users (a). Next, you use the operator '+' or '-' to either add or remove privileges, respectively. Lastly, you use the letters r, w, and x to select the new permissions for the file. For example, to change the permissions for all users to have read, write, and execute permissions, you would execute: chmod a+rwx FileName. To remove the write privilege from the owning user, you would execute chmod u-w FileName. For additional information on chmod, execute man chmod in the terminal. Related Links: KnowledgeBase 2LC8I2IT: Troubleshooting Serial Communication in Linux Attachments:
Report Date: 08/20/2002 Last Updated: 12/20/2007 Document ID: 2OJE838R |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
