Getting to Know Linux Security: File Permissions

advertisement
Getting to Know Linux Security: File Permissions
(Thursday, 03 February 2005) - Posted by Benjamin D. Thomas
Welcome to the first tutorial in the 'Getting to Know Linux Security' series. The topic explored is Linux file permissions. It
offers an easy to follow explanation of how to read permissions, and how to set them using chmod. This guide is
intended for users new to Linux security, therefore very simple. If the feedback is good, I'll consider creating more
complex guides for advanced users. Please let us know what you think and how these can be improved. If you have
ideas for future topics, please post them in the discussion forum below.
{mos_sb_discuss:13}
Click image to begin tutorial.
Script
Hello, my name is Benjamin Thomas and I am with Guardian Digital, Inc, the
primary sponsor of LinuxSecurity.com Welcome to the first of the "Getting to
know Linux Security" series tutorials that will be featured on our site. Today's
topic is file permissions. This lesson is primarly intended for those users
who are just getting started, and other wishing to brush up old skills. The
examples I show you today are from a typical Linux command line. Today, I'll
be using EnGarde Secure Linux. More information about this distribution can
be found at Guardian Digital.com and it can be downloaded at EnGardeLinux.org.
...
Lets Begin. To see a listing of files in a directory, execute the command
'ls'. As you'll see, there are no files in the temporary directory that I'm
using. Let's first create several files.
touch file1 file2 file3
The command 'ls' then shows the files we have created. A more informative way
to show the files is ls -la. The 'l' switch lists files in long format, and
the 'a' switch lists all files, including hidden ones.
...
Lets look at file1 (select line)
The first field reprents the file's type. For regular files this is always a dash, for directories, it will be reprented as a d.
(There are other's, but beyond the scope of this lesson)
http://www.linuxsecurity.com - LinuxSecurity.com
Generated: 6 February, 2005, 14:22
The next nine represent the file's permission.
The the number of 'hard' links to the file, the file owner's username, the owner's group, the file's size, its modification
date and
time, and the file's name.
...
Lets examine the permission field closer. The first three blocks represents
the access granted to the file's owner. The next three, represent access granted
to other group members, and the last three represent everyone else's level of
access. The possibilities for permissions include:
r - read
w - write
x - execute
- - no permission
...
If you are the owner of a file, you have the ability to change its permissions
with the chmod command. There are several ways chmod can be used, however in
today's lesson I will only focus on the octal system. The first number represents
the owner's permission, the 2nd represents the groups permission, and the last
one' represents the world's or everyone's access. The permission is calculated
using simple arimetic. 1 is for exectute permission 2 is for write permission
4 is for read permission
The permission is set using the chmod command:
chmod 755 file1
You may asking, but what does 755 mean? 7 comes from 1 + 2 + 4. 5 comes from
1 + 4. This means that the file's owner has read, write, and execute permission,
but group and world only have read and execute.
...
Overtime you'll find that this method of setting permissions becomes natural.
http://www.linuxsecurity.com - LinuxSecurity.com
Generated: 6 February, 2005, 14:22
After getting comfortable with this method you'll find that Linux permisssion
aren't difficult at all to understand.
...
Once again, thank you for visiting LinuxSecurity.com. I hope you have found
this guide helpful and you are looking forward to other tutorials in the Getting
to know Linux Security series. Please do no hesitate to send comments, questions,
or ideas to me at the following email address: ben@linuxsecurity.com
...
This guide has been sponsored by Guardian Digital, creators of EnGarde Secure Linux. www.guardiandigital.com
http://www.linuxsecurity.com - LinuxSecurity.com
Generated: 6 February, 2005, 14:22
Download