|
RootSmart.com Podcast|Rootsmart Podcast #34 3/23/06 Episode
Get it Now!
mp3 file
Contact Details:
Email: questions@rootsmart.com
Voicemail: (206) 734-4825
Skype: rootsmart
Vote for us at Podcast Alley
Content:
Today we are starting a many part series on running linux
we are going to step through linux and show you how to use it, and what it all means
today we are going to be talking about users.
so when you first start up your linux box you are probably greeted with a login box
you login to your user account and everything is good
until you have to do any system changes.
then you have to login as root
do you know why this is?
it is mainly a way to keep Linux secure
Everything in a Unix environment has permissions
these permissions tell the system if you are allowed to access the file
if you are allowed to access the file what rights do you have?
to view the permissions of a file, if you are running a Desktop environment you can right click on the file and choose properties, or at the command line type ls -l file
as you can see in the graphical environment, there are three user types and under each type is three abilities
the abilities are read, write, or execute
the three user types are User, Group, Other
User is the owner of the file or directory
that basically means who created it
if it is in your home folder you probably created it
if it is in the etc folder or any of the system folders root probably created it
only the owner can edit permissions
all users belong to at least one group
by default you belong to your own separate group
you can easily put you and a number of other users into a group
that way you can have multiple users with the same permissions
also the group that has takes effect is the owners group
to create a group type groupadd groupname
then to add a user to a group type adduser user group
it is very easy, just make sure the owner of the file is in that group
the last user type is other
this is basically everyone else
if you are not the owner, or are not in the owners group you are other
so now we have three types of group permissions
the first is read
read means that if it is directory you can see what is in it, but not change anything
the second is write
this says if a user and create a new file in a directory
or delete files
or it says if you can edit text files or any other file
the last is execute
this says if a person can go into the directory, or if a person can execute and program
now changing all of these is easy to do if you have a graphical interface
in KDE or GNOME just right click on the files, go to permissions and edit away
it is that easy
with the command line it is a little harder, let me explain
first type ls -l filename to see what the current permissions are
remember that r is read, w is write, and x is execute
you will see something like -rwxr-xr-x
the first charecter is whether it is a directory this will have a d if it is
the next three are the permissions for the user
then after those three are the three permissions for the group
then other
to edit permissions in the command line we use the chmod command
if you want to do something that affects all users, lets say stop anyone from executing it type
chmod a-x filename
a stands for all and the -x or minus x clears the x bit
so if you want to add the ability to read for group type chmod g+r filename
as you can see + adds a permission, and - removes a permission
also you use u for user, g for group, and o for other
if you would like to add more than one permission to more than one user type you just type chmod ug-wx filename this will remove the write and execute bit from the user and group
so that is pretty easy,
lets go on to these number that you might see
if you want permissions of rwxr-xr-x you type chmod 755 filename
this works out like this the read bit is worth 4 the write bit is worth 2 and the execute bit is worth 1 so:
4+2+1=7
4+0+1=5
4+0+1=5
that makes sense
a very common triplet is 777 this is for all access to all user types it works out like this
4+2+1=7
4+2+1=7
4+2+1=7
so that is all with user permissions. I hope this helped
Technorati Tags: Linux, Users, RootSmart.com
[ Sun, 23 Apr 2006 15:46:25 -0400 ]
|