Reset ownership of every home/.../domains directory

nieuwhier

Verified User
Joined
Sep 8, 2005
Messages
279
Location
Netherlands
After restoring backups on other servers rights of some directories were changed within the users domains map. The user was unable to delete some logfiles where the owner of the map was suddenly root.

I was looking for a simple script that could change this for me. I am not a Shell script wonder but created the following:

ls -l /home | grep '^d'|awk '{print "chown /home/"$3"."$4" "$9"/domains -R"}' > ./sethome2
echo "Printing generated file sethome2. FIRST CHECK this file and then execute with sh ./sethome2"
cat ./sethome2

This will create the file sethome2 with all chown commands in it.
I hope it is of some use to you.
 
ls -l /home | grep '^d' | awk '{print "chown", "-R", $3 ":" $4, "/home/" $9 "/domains"}'

Is more of what you wanted anyways.
 
I used the .sh_permissions file....

But it messed up the imap directory. That should be 770 but after the script it was 755 so creation of messages failed.

This is the line that caused it:
set_file $UHOME/imap $1 mail 755 -R

Don't know why but the dovecot part is not executed, or in the wrong order.
 
Thanks for the report. I've changed it to 770.
Note that the 755 was for wu-imap, but 770 should still work with wu-imap since it has root.
Also "./set_permissions.sh all" will also have worked... as "email" is done after "user_homes".. and the user_homes is the one with the 755 setting. The email run after user_homes would override it with the proper 770 setting.

So basically, this bug affect you if you have dovecot and run:
./set_permissions.sh user_homes

The solution is to either change it to 770 for the line in question, or simply run:
./set_permissions.sh email

afterwards. The "./set_permissions.sh" all will also work fine.

This will be available/default for the next release.

Thanks,

John
 
logfiles are normally owned by root

The owner of the logfiles is root normally. I think this is a feature, because the amount of data is not counted for the user, in other words he will not complain about running out of diskspace.

(Maybe next year (in the Netherlands) you are forced by law to keep the logging for a year or so and then the user is not even allowed to delete the logging....).
 
Back
Top