Re: file permissions



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@xyrias:~$ chmod +r,go-w,u+w,-x my_file
celtic@xyrias:~$ ls -l my_file
-rw-r--r--  1 celtic celtic 17 2006-01-27 12:00 my_file
celtic@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.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
https://lists.ubuntu.com/mailman/listinfo/ubuntu-users


Relevant Pages

  • Re: "RAMNIT desktoplayer" Worm Removal Guide
    ... The ability to define permissions on folders and files have been ... permit execute permissions for folder and its child objects (files ... permissions allow for executables to load from there. ... Execute permissions can be removed from any folder or file and some ...
    (alt.comp.anti-virus)
  • Re: sa privileges and roles
    ... permissions of that account. ... Another option is to create a dbo-owned user proc in an sa-owned user ... in your user database and grant execute permissions only on your user proc. ... SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: wshShell.Run - permission denied
    ... cmd.exe to ensure that the IUSR_CPUNAME and IWAM_CPUNAME accounts have ... dim WshShell, retCode ... should have at least read and execute permissions to the CSCRIPT.exe ...
    (microsoft.public.scripting.wsh)
  • Re: Problem with Performance Monitor Alerts and "Run As" command
    ... If it runs as an admin then there must be a permissions problem. ... First check that the account has read and execute permissions to the ... script that you are running, and also that BATCH has permissions to ... When creating the Performance Alert and this user is put into Administrators ...
    (microsoft.public.windows.server.general)
  • Re: Need for default umask
    ... permissions would presumably be expected to do something like: ... instance, if you're saving a script from a text editor, you'd like it to ... but it's unlikely that you would need to turn ON execute permissions as ...
    (comp.unix.internals)