February 25, 2017, 04:28:59 AM

News : LinuxSolved.com Linux Help Community Forum..

Author Topic: Chmod help in Linux and Ftp and windows 777, 666 ?  (Read 4980 times)

Offline linuxhelp

  • New Member
  • Posts: 1
Chmod help in Linux and Ftp and windows 777, 666 ?
« on: February 10, 2004, 06:14:31 AM »
I am using windows but  i am having hosting on a linux server , wht I see there that it has some ftp chmoding..   When i searched through i found that chmod is actually a Linux Command.. wht is it , how it works, and wht are those NOs ?
Please help me out..

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
Chmod help in Linux and Ftp and windows 777, 666 ?
« Reply #1 on: February 10, 2004, 06:52:11 AM »
Nothing to confuse here.. Chmod is actually a linux command which sets the permission for a file.. ie. who can access those files and who can not . Or the file is executable or not...
Chmod give gives the code for permission.. those are like. 677 or 777 or 755 more
Well here 777 means read write and execute by all..

I can be little more decriptive.. So
it has got mostly three digits some times there can be four .. that is not for you!!
Now. first digit is for owners persmissions setting, second is for group and third is for others..

7 = all allowed.
4 = read only
2 = write
5 = read and execute
1 = execute

and when we say 755 the we are saying that owner has full permission (7) and group has only to read and execute (5) and also same for others (5) ..
I hope you get it...
or need more explanation....

Please point me .. if i have done any error..

Offline aaa

  • Tux Awared
  • **
  • Posts: 38
Chmod help in Linux and Ftp and windows 777, 666 ?
« Reply #2 on: February 10, 2004, 05:26:47 PM »
Here's an example I found on Google:
-rw-r--r--   1 wilker   topology   337127 Aug  5 12:54 BOliver97.gif
user: wilker
group: topology
size: 337127
Modification date: Aug  5 12:54
filename: BOliver97.gif

Permissions are like this:

Note the three sets of 'rwx'. They represent what someone is allowed to do with a file. The first three are for what you (or the owner, the one who made the file) can do with the file. The second is for people of the file's group. The third 'rwx' is for everybody else.
The group is something users can be a member of. Say there was a 'ourgroup' group. If you are in this group, the files you make will be in this group. Anyone else in this group can access the file according to how the second 'rwx' dictates.
rwx: R is for Read, W for Write, and X for eXecute. rwxrwxrwx means anyone is allowed to do anything with the file. If a place where a letter would be has a dash (r-- instead of rwx), these actions are not allowed on the file by that category of people (owner,group,world).

Let's look at the example:
The first dash is for something other than permissions. We see a 'rw-' after this. This is for the owner (wilker). He can Read and Write the file, but can't eXecute (can you execute a picture?).
Next we see 'r--'. This is for whoever is in the 'topology' group. W is blanked, so the file can't be modified. It is still readable.
The last three are also 'r--'. The rest of the world also only has read-only access.

Now for how to change these permissions with chmod. There are two ways to do it numbers (777) and letters (a+rwx).

Here's a way to remember the numbers:

['r'+'w'+'x'] ['r'+'w'+'x'] ['r'+'w'+'x']
[4+2+1] [4+2+1] [4+2+1]
7 7 7

["r"+"w"+"-"] ["r"+"-"+"-"] ["r"+"-"+"-"]
[4+2+0] [4+0+0] [4+0+0]
6 4 4

'chmod 644 [file]' gives 'rw-r--r--' permissions

The letters work like so:
chmod [a letter (u,g,o, or a)][+ or -][new permissions(like rwx)]
chmod u+rw
u means users (we are adding (not replacing) rw permissions to the first rwx)
g is for group (g+rw to add permissions to second rwx)
o is for the third rwx, everybody else
a is for everybody (rwxrwxrwx, not just three).


chmod 777 a_file
a_file now has rwxrwxrwx permissions

chmod 666 a_file
a_file now has rw-rw-rw- permissions

chmod 644 a_file
a_file now has rw-r--r-- permissions

The letter style adds permissions, while the number style replaces them. The end result with letter style is dependent on how the file was before.
See man page for more details:

BTW, Ricky, what is the fourth number for?
The first  digit  selects the set user ID (4) and set group ID (2) and save text image (1) attributes.
I saw this i the man page, but didn't get it .