[Cumbria] Chmod

Schwuk cumbria at mailman.lug.org.uk
Mon Jan 13 19:33:00 2003


Mat Brunt wrote:
> A complete beginner's question for you all :-

Typical answers:

man chmod

search on google.com for chmod.

My answer:

Actually the first answer is a pretty good one, and remember the man 
command - it is your friend! Man brings up man(ual) pages for commands.

You don't have to be root to create directories - you have to have write 
access to the folder you wish to create them in - if you want to create 
a folder in your home directory, try:

mkdir afolder

To view the permissions on a file, use:

ls -al

File access is broken down into three sets: User, Group and Other. For 
your files, User and Group will generally be set to your id (When your 
account is created, a group is created with the same name and token.). 
File permissions are broken down in three types - Read, Write and eXecute.

So, to give everyone full (Read, Write and eXecute, or rwx) access to 
the directory you just created:

chmod o+rwx afolder

To change the Owner(User) of a file (say if you'd created a folder as 
root and wanted to assign to a user):

chown auser afolder

To change the Group of a file:

chgrp agroup afolder

All of these commands accept the -R arguement which means Recurse (i.e. 
touch that folder and all files and sub-folders contained therein).

You can also specify permissions using numeric(octal) values:

chmod 777 afolder

Check the chmod man page for more details (also the mkdir, chown and 
chgrp ones)

Hope that helps...
-- 
Schwuk