Jack Makinson
New Member
Hi all, can you tell me what the chown command is to set all files to read & write?
Thanks in advance
Thanks in advance
Hi all, can you tell me what the chown command is to set all files to read & write?
Thanks in advance
chmod 666 your-file.txt
chown {options} {new owner}:{new group} {list of directories and/or files...}
chown dave:users someTextFile
chown {options} {new owner} {list of directories and files...}
chown -R dave ./someFolder
chown {options} :{new group} {list of directories and files...}
chgrp {options} {new group} {list of directories and files...}
Nice explanation!Jack, atanere is 100% correct. You should be using the chmod command NOT chown.
But atanere failed to explain what chown is and what it does.
So here goes:
The chown command is used to change ownership of files and/or directories. (Whereas chmod is used to modifiy the access permissions for owner, group and other users.)
As atanere has explained, when you want to change the access permissions, you must use chmod.
You would only use chown when you want to transfer the ownership or the group ownership of files/directories to a different user/group.
The syntax for the chown command is:
e.g.Code:chown {options} {new owner}:{new group} {list of directories and/or files...}
Would make dave the owner of someTextFile and the group would be users - so anybody in the users group would have group access to the file - their level of access would be dependent on the file permissions that are currently set. Again, if you need to change the permissions for owner, group or other users you would use chmod.Code:chown dave:users someTextFile
To change only the owner using chown:
e.g.Code:chown {options} {new owner} {list of directories and files...}
Would make dave the owner of someFolder. Because we used the -R option, it will recursively apply the ownership to all files/sub-directories in ./someFolder.Code:chown -R dave ./someFolder
To change only the group ownership:
Code:chown {options} :{new group} {list of directories and files...}
Or you could use chgrp:
Code:chgrp {options} {new group} {list of directories and files...}
To summarise:
When you want to change the permissions for files/directories - use chmod.
When you want to change ownership of files/directories - use chown, or chgrp.