|
Linux Chmod -rw-rw-r-- 1 newuser newuser 150 Mar 19 08:08 sneakers.txt Each permission setting can be represented by a numerical value: r = 4
When these values are added together, the total
is used to set specific permissions - more specific than changing permissions
with the alphabetical "shorthand."
- (rw-) (rw-) (r--)
The total for the user is six, the total for the group is six and the total for others is four. The permissions setting, then, is read as 664. If we want to change sneakers.txt so those in our group didn't have write access, but could still read the file (as shown in Figure 13-20), we'll have to remove the access by subtracting 2 from that set of numbers. The numerical values, then, would become six, four and four -- or 644. So we can type: chmod 644 sneakers.txt Let's check our changes by listing the file (ls -l sneakers.txt): -rw-r--r-- 1 newuser newuser 150 Mar 19 08:08 sneakers.txt And there it is; now, neither the group nor others
have write permission to sneakers.txt. To return the group's write
access for the file, we can just add the value of w (2)
Beware 666 and 777 Biblical implications aside, setting permissions
to 666 or 777 will allow everyone to read and write to a file or directory.
Such settings as these could allow tampering with sensitive files, so in
general, it's not a good idea to allow these settings.
-rw------- (600) -- Only the user has read and
write permissions.
Here are a couple common settings for directories: drwx------ (700) -- Only the user can read, write
in this directory.
You can change permissions with the chmod command by using letters or numbers. Type chmod permissions file to change permissions of a file or directory.
Have a Linux Problem
Linux Books
Linux Home: Linux System Administration Hints and Tips (c) www.gotothings.com All material on this site is
Copyright.
|