Click to See Complete Forum and Search --> : Firefox downloads to data partition, not home folders


homerun
08-27-2009, 11:28 AM
I am trying to properly set file and folder permissions on my data partition, so that I can download files with Firefox, as well as create documents with notes detailing my Linux discoveries with gedit, etc. I want this to work from numerous multiboot linux distros to the same data partition.

I already have numerous files and folders in the data partition, and I am trying to change the setgid of each directory so that all new files and folders created in the directories will have "users" as the group ownership. The following command works for me except that it also changes the setgid of the "." file in each directory:

Note the permissions on the first line after the two ls -la commands:


ls -la
drwxr-xr-x 13 root users 4096 Aug 27 08:12 .
drwxr-xr-x 8 root users 4096 Aug 27 08:12 ..
drwxrwxr-x 3 root users 4096 Aug 26 12:05 Suse

find -type d -ok chmod g+s {} \;
< chmod ... . > ? y
< chmod ... ./Suse > ? y

ls -la
drwxr-sr-x 13 root users 4096 Aug 27 08:12 .
drwxr-xr-x 8 root users 4096 Aug 27 08:12 ..
drwxrwsr-x 3 root users 4096 Aug 26 12:05 Suse

chgrp -R users *
umask 002


I'd rather use "find -type d -exec chmod g+s {} \;"
I am not sure of the consequences of leaving the "." file with drwxr-sr-x permissions. As I write this I now wonder if perhaps this is what it should be!

I looked for an exclusion (-e option) such as -e -type "?", but couldn't find what I needed. I wouldn't have even noticed if not for the results from the find command's "ok" opton.
< chmod ... . > ? y or
< chmod ... . > ? n

Thanks.

furrycat
08-27-2009, 11:56 AM
Use the -mindepth option to to skip the higher directories in the tree.

(You didn't say what the parent of Suse was. Let's say for the sake of this example that it's /data as that's easier to see than a dot...)

So if you didfind /data -mindepth 1 -type dyou would hit /data/Suse but not /data itself. If you didfind /data -mindepth 2 -type d you would hit /data/Suse/wibble and /data/Suse/wobble but not /data or /data/Suse.

homerun
08-27-2009, 01:01 PM
Thanks furrycat.

That would appear to solve my problem. At first I thought your suggestion would not solve the problem of changing the permissions on the "." files in all the subdirectories. However, as a test after reading your post, I ran my original command and proceeded to answer "y" until I reached deeper subdirectories. I was NOT asked to confirm changing permissions on the "." files in the subdirectories of "data" (actually it was Documents as in /mnt/sda15/Documents) <grin>

Thus, the only problem was with the "." file in the current directly in which I ran find, which your command "find /data -mindepth 1 -type d" should solve.