One cannot understand unix and its capabilities until he understands general permissions.. it is the basics of unix and highly important to make things work and keep them safe from harm.In this post i will attempt to explain the basic usage of chmod and explain file permissions.
First of all i will explain a simple Unix format file permission.. what you would see on a ls-l in your shell
-rwxr-xr-x 1 mark wheel 14 Oct 19 15:14 .xsession
the first part is the permissions themselves .. the "1" is the number of files... if this was a directory it would be more obviously... the owner of this file is USER mark .. the GROUP this file belongs to is wheel.... the date and time the file was created ... and lastly the name of this file is .xsession
The permissions in unix are split up into sections... the very first letter is specia,l usually you will see either nothing here or a d.. meaning directory.. the next three digits are for USER, perissions in this files case rwx for USER mark, so full access.. the next three are for GROUP permissions.. r-x in this files case meaning anyone belonging to GROUP wheel can read and execute this file.
the last three digits are for USER nobody.. meaning guests on the comp .. this could be many things like anonymous ftp for example or simply used so someone can read this file who is not USER mark or belonging to GROUP wheel.
Now the fun part lol .. in unix, chmod is a command for changing file permissions, it has many options but i will explain the basic uses of it.. in order to use chmod correctly you must know the numerical values of permissions, these are in very simple terms...
r (read access) = 4
w ( write access) =2
x (execute access ) =1 or "able to cd to" for a directory
these are also grouped like above, user group and nobody.. so a three digit number the first for USER the second for GROUP the third for "user nobody"
so if we break down my exmaple file
-rwxr-xr-x 1 mark wheel 14 Oct 19 15:14 .xsession
rwx(user) ... equals r=4 + w=2 + x=1... so our first number is 7
r-x(group)....equals r=4 + w=0 + x=1....so our second digit is 5
r-x(user nobody) ..equals r=4 + w=0 + x=1...so out third digit is 5
so that file is 755
The use of chmod is simple.... chmod 755 filename would make "filename" rwxr-xr-x
The second use which lazy people use or people who dont understand the numerical values is chmod +x or +w or +r filename
like chmod +x filename ... would add x to the USER,GROUP and user nomody permissions
so if i had a file that was simply -rw------- ... chmod +x filename would make it rwx--x--x which is ok if thats what you want it to be however many lazy people dont take the time to learn perms and simply use this and compromise the security of the file in question
chmod in ftp works the exact same way... in ftp from a shell it is identical to what i said.... in a ftp client the interface might have like fancy check marks for read write and execute but its all the same thing, if you understand this you will know which exact permissions you are setting regardless..
hope this helps
just a clarification on my above post..
in order for a file to be accessed\written\executed you must have permissions to do so on the full path of a file... for example
file 1 located in /usr/home/gumby/folder1/myfile.html
in order for me to access that file... i must have perms on each folder it is in... starting from /usr and then down the line...
so the final perm deciedes what i can or cannot do with that file... altho if i cant access the folder itself obviously my perms on that particular file are irrelevant
One cannot understand unix and its capabilities until he understands general permissions.. it is the basics of unix and highly important to make things work and keep them safe from harm.In this post i will attempt to explain the basic usage of chmod and explain file permissions.
First of all i will explain a simple Unix format file permission.. what you would see on a ls-l in your shell
-rwxr-xr-x 1 mark wheel 14 Oct 19 15:14 .xsession
the first part is the permissions themselves .. the "1" is the number of files... if this was a directory it would be more obviously... the owner of this file is USER mark .. the GROUP this file belongs to is wheel.... the date and time the file was created ... and lastly the name of this file is .xsession
The permissions in unix are split up into sections... the very first letter is specia,l usually you will see either nothing here or a d.. meaning directory.. the next three digits are for USER, perissions in this files case rwx for USER mark, so full access.. the next three are for GROUP permissions.. r-x in this files case meaning anyone belonging to GROUP wheel can read and execute this file.
the last three digits are for USER nobody.. meaning guests on the comp .. this could be many things like anonymous ftp for example or simply used so someone can read this file who is not USER mark or belonging to GROUP wheel.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum