[PLUG] Chmod question, before I mess things up

Rogan Creswick creswick at gmail.com
Thu Dec 17 04:58:43 UTC 2009


On Wed, Dec 16, 2009 at 6:33 PM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
> On Wed, 16 Dec 2009, John Jason Jordan wrote:
>
>> -rw-r--r--.  1 jjj jjj  11968 test_pdf_form.pdf
>> -rw-------.  1 jjj jjj  1552141 thinkpad_ultrabay.pdf
>> -rwx------.  1 jjj jjj  2240700 ubuntupocketguide-v1-1.pdf
>> -rw-------.  1 jjj jjj  4822994 ultrabay_adapter_40y8746.pdf
>> -rw-rw-r--.  1 jjj jjj 20839 Baker03.odt
>> -rw-r--r--.  1 jjj jjj  70 VLC_radio_playlist
>
> John,
>
>   None of the above should be executable.

It also doesn't *really* matter that they are, though.  If you should
try to run a pdf as a script, you'll just get some error, or nothing
at all. (shell vs. a double-click in some file browser.

An earlier post eluded to this, but I don't think it's been spelled
out:  To make a your file read/write by any member of the jjj group,
use:

  $ chmod g+rw somefile

That will not *remove* permissions, it will just add the bits
necessary to give groups (g) read (r) and write (w) permissions.  For
directories, use:

   $ chmod g+rwx somedir

because you will want directories to be searchable too (the
"executable" (x) bit makes directories useful -- you almost always
want it if the directory is also writable.).

You can apply those commands to everything in your home directory with:

$ find ~ -type f | xargs chmod g+rw

and

$ find ~ -type d | xargs chmod g+rwx

Disclaimer:

It's always *possible* to mess something up royally, especially when
using find and some other command.  I think that's pretty unlikely,
and you seem to have backups of everything you ever do, so this can be
fixed by analyzing those :).  I would suggest trying these commands
out on a sample directory tree, to make sure they do solve your
problem.

You will also still need to set your umask so future files are created
as you wish.

--Rogan


> All you'll do with the .pdf files
> is read them; they can be 444 without harm since no one can directly write
> to them. The .odt file is an OpenOffice.org text file; also with the proper
> permissions.
>
>> drwx------.  4 jjj jjj  Website
>
>> I note that all my directories are executable. Perhaps there is a
>> reason for that. But there is a PDF that is executable. Why?
>
>   'Cause you cannot cd to that directory unless it's both writable and
> executable. I always forget the exact relationship, but either w or x lets
> you cd into the directory, the other allows you to list the files in there.
>
>> There is an OOo Writer file that is -rw-rw-r--, where most plain data
>> files are rw-r--r--. Why?
>
>   No particular reason. In the second case only the owner can write to the
> file, but anyone can read it. It all depends on who you want to read and/or
> write to that file.
>
>> Every folder on my computer has a similar m?lange of permissions for
>> data files.
>
>   Make all directories and executable files 755; other files 664.
>
>> Also, just now I created a test file with Gedit. It appears as:
>
>> -rw-rw-r-- 1 jjj jjj 5 Test.txt
>
>> So apparently jjj's umask in Fedora 11 is to create files that are
>> -rw-rw-r--. And apparently jjj's umask when he (I) used to use Ubuntu
>> was -rw-r--r--. I can change the permissions on the older files to
>> -rw-rw-r--, but what happens if the (now) me downloads a file instead
>> of creating it de novo? Will it be -rw-rw-r--? What happens when I do a
>> dist-upgrade to Fedora 12 - will it change my umask? I want
>> things consistent and predictable. Once I clean up the mess I don't
>> want to proceed to create a new mess.
>
>   1.) Ignore all this unless you have nothing better to obsess over. You're
> getting so wrapped up in insignificant details (at your level of use) that
> you're missing the big picture.
>
>   2.) Look at 'man umask' to see default perms on new files.
>
>   3.) The permissions won't change or affect anything if you change
> distributions.
>
>
> Rich
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>



More information about the PLUG mailing list