Click to See Complete Forum and Search --> : so new directories are automatically a certain group


Sawdusty
08-05-2003, 04:34 PM
Hey,

I'm using GTKam and GQView to store and manipulate photos in a directory that should be accessible to all users on my system. I want to be able to set it so that all directories created by either of these programs are:

a. chown .user
b. chmod g+w

I also wanted the programs to automatically load in the directory /home/Photos/unsorted

To do this, I renamed the binaries gtkam and gqview to gtkam2 and gqview2, and created two bash scripts to replace the original files (so that the Mandrake Menu and desktop items automatically run my scripts instead of the original binaries).

The scripts currently look like this:

cd /home/Photos/unsorted
gtkam (or gqview depending on the script)

But I don't know how to do parts a and b above. Basically I want to have scripts like this:

cd /home/Photos/unsorted
make all new directories chown .users
make all new directories chmod g+w
gtkam (gqview)

I think I can auto-change the g+w using the umask command, but I don't know how to use that (the man page just tells me its a bash builtin, and I can't figure it out from the bash man page). I don't know how to make it so that all new directories are automatically changed to belong to the group "users".

Any ideas?

Thanks,

Dusty

Stuka
08-06-2003, 09:40 AM
The umask is the inverse of the permission bits you want on. I'm guessing that you want the permissions to be rwxrwxr-x, or 775. The umask for this would be 002 (777-775 if you will). So, just run umask 002 and that should give you what you want.