Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a daemon running with a user (let's call it) myuser. I wanted him to be able to read and write the files in the /var/www directory. The owner of this directory and all the files inside it is www-data (the user of apache2). So I added myuser to the group www-data with the addgroup command, and did a chmod recursively on all the files in www-data. So now i have something like rwx rw- r-x on every files. The command 'groups myuser' tells me that my user is in the groups www-data and myuser, so everything is ok here.

Now I'd like to refresh the groups permissions, cause my daemon is still running, and he can't write anything in /var/www. I read the manpage for the newgrp command, but I think that this command can refresh the permissions only for my current user, not the user of my daemon (or if i can, I don't know how to use it...).

So my question is: How can I refresh the rights of myuser without reboot? Should I restart the daemon?

Thanks for your attention.

All the best :)

share|improve this question

5 Answers 5

Restarting the daemon will do it, but it is probably enough just to restart the part of the daemon that switches to the user (e.g. killall -HUP httpd).

share|improve this answer

Yes I did, and the daemon can't even read the files. I'll try to /etc/init.d/daemon restart later, for now it's not possible. I'll tell you when it'll be done.

share|improve this answer

Maxfer is right. Nothing needs to be refreshed or restarted. However, if I read your question correctly you're missing execute permission on the group which would is probably causing your daemon not to be able to read (or write) any directories in /var/www

It should be:

rwxrwxr-x

share|improve this answer

My user "myuser" is in the groups myuser and www-data. a ls -l in /var/www is like this: rwxrw-r-x www-data www-data on everyfiles (including .) And my daemon couldn't write those files or create a new directory in /var/www. So the right of the others were applied: r-x, and not the rights of the group rw-

But I agree, there's an incoherence here, the rights in /var/www should be rwxrw-r-- or rwxrwxr-x not rwxrw-r-x :)

Now that my daemon has been restarted, it's ok, he can create directories, and write files in /var/www. So like Daenyth and Ignacio said, the rights of the user of the running process are not updated untill you restart the process.

Thank you everyone

share|improve this answer

I think is not necessary refresh anything. When your daemon tries to access one of these files, linux will allow. Do you try it whitout restart?

share|improve this answer
1  
When a user is added to a group, that will not apply to any currently running processes, as the process stores knowledge of what group the user is in. Any children will not have the updated info either. This is why you typically see instructions to log out and log back in when changing your user's groups. –  Daenyth Jul 8 '10 at 20:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.