File permissions?

Fred Roller froller at tnclimited.com
Fri Dec 25 04:53:50 UTC 2009


Jim Byrnes wrote:
> I've been using Ubuntu for about two weeks now and am starting to get 
> used to it.  However, coming from an OS/2\Windows world file permissions 
> seem to be giving me some grief.
>
> Maybe if someone could tell me how to do a couple of specific tasks it 
> would become clearer to me.  I have Jedit loaded on all three of my 
> OS's. I have modified some mode files on the other OS's I would like to 
> use on Ubuntu.  I copied them to a shared folder on Ubuntu but I can't 
> copy them to /usr/share/jedit/modes which is where Jedit will look for them.
>
> In that same vein, if I wanted to edit one of those files with Jedit how 
> could I get Jedit to open it for editing?
>
> Thanks,  Jim
>
>   
Jim,
    Welcome to Ubuntu.  I too have passed files from OS to OS.  There 
sounds like you have one of three options.  First a quick lesson on 
permissions in Ubuntu (Linux); and I apologize if this is basic.  A file 
is read, written, or executed by either the user, a group, or others 
(aka all others) so if you open a terminal and from command line try the 
following:
      
    froller at metis:~$ touch yourfile
    froller at metis:~$ ls -l yourfile
    -rw-r--r-- 1 froller root 0 2009-12-24 23:05 yourfile
    froller at metis:~$

If you note the "-rw-r--r--"; this is actually four sets "- | rw- | r-- 
| r--".  Followed by "froller root" or "user | group". 

The first set is simply a "category" if you will, "-" is a regular file, 
"d" would be directory, "l" would be a link, etc. 

The other three sets "rw- | r-- | r--"  are your permission sets  They 
are, respectively, the user, the group, and the other.  The user, or 
owner of the file; indicated by the "froller" can read and write but not 
execute.  The second set "r--" means anyone in the "root" group, similar 
to a "workgroup" can, in this case, read the file but not write or execute.

Back to your question:

1. The easiest (and yes, least secure) would be to change the permission 
of the file to full access for all.

    sudo chmod 777 yourfile

I prefer to work with the number method and can explain if you wish; 
but, this would give you permissions which look like:

    -rwxrwxrwx 1 froller root 0 2009-12-24 23:05 yourfile

you can read the manual for more information on chmod:
   
    man chmod

2. You could change the owner to your Ubuntu user.  If your file starts 
like:

    -rw-r--r-- 1 root root 0 2009-12-24 23:05 yourfile

where "root" owns the file, then:

    sudo chown froller yourfile

where froller is your user then the file would look like:

    -rw-r--r-- 1 froller root 0 2009-12-24 23:05 yourfile

giving your user read/write access to the file.  Read more on "chown" with:

    man chown

3. Perhaps the simplest solution would be to run jedit as root with:

    gksu jedit

Again, be careful of security.  You are running a program with compiling 
capability as the root user.  Advantage is that permissions are a none 
issue with this option.

Hope this helps.  Permissions in Linux becomes real easy with practice 
so you should catch on quickly.

-- 
Fred
www.fwrgallery.com

"Life is like linux, simple.  If you are fighting it you are doing something wrong."





More information about the ubuntu-users mailing list