file permissions

Yuki Cuss celtic at sairyx.org
Fri Jan 27 01:02:53 UTC 2006


Ray Canzius wrote:

>G'day all,
>
>I am new to Ubuntu and I  am having problems finding out how to change
>file permissions.
>Anybody give me any clues.
>
>
>Regards
>                Ray
>  
>

Ray,

If you're using a console, it's quite simple:

chmod [ugo][+-][rwx] FILEs

Let me explain: in the `ugo' bit, it stands for `user', `group' and 
`others'. `rwx' stands for `read', `write' and `eXecute'.

Let's say you want to deny `others' (that is, everyone not in your 
group, and who is not you) permission to write to your file; rightly so. 
The command would be this:

chmod o-w my_file

How about, you want to give yourself access to read, write and execute?

chmod u+rwx my_file

Note that `execute' permissions are only useful on a) directories, and 
b) programs or scripts. You can also string these little bits together, 
like so:

chmod +r,go-w,u+w,-x my_file

By omitting the `ugo' parts, you imply it's all. This command above 
gives *everyone* read access, takes away `group' and `others' 
permissions to write, gives *yourself* write access, and gives no one 
execute access (presumably it is not needed).

To look at permissions on a file, type `ls -l my_file'. For example:

celtic at xyrias:~$ chmod +r,go-w,u+w,-x my_file
celtic at xyrias:~$ ls -l my_file
-rw-r--r--  1 celtic celtic 17 2006-01-27 12:00 my_file
celtic at xyrias:~$

Here, we can see that: a) `celtic' is the owner of the file, b) `celtic' 
is the group of the file, and the permissions. The permissions are 
written in this way:

`Suuugggooo'

S can be a hyphen, meaning a normal file (like here), a `c', indicating 
a character device file (like your keyboard), a `b', meaning a block 
device file (like your harddrive), or a `d', meaning a directory.

Then follows is the same `permission' set for user, group and others: 
--- means no permissions, rwx means read, write and execute permissions, 
or there might be some missing, eg. rw-, meaning only read/write.

You can control these same permissions from Nautilus, by right clicking 
the file, choosing `Properties' and selecting the `Permissions' tab. 
There are also `user ID', `group ID' and `sticky' bits, but those are 
more advanced concepts. (to do with execute permissions and if you can 
delete files)

Hope this helps,
 - Yuki.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2917 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20060127/0dd1a6e2/attachment.bin>


More information about the ubuntu-users mailing list