Really simple, I run the following in Ubuntu 14.04 Server, logged in as
sudo usermod -a -G www-data max
When I run
groups as max after doing so, www-data is not in the output set of groups.
Any idea what could cause this?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
I assume they are correct and you did not logout/in or reboot...
It is best to get into the habit of restarting or at least logging out and then back in when manipulating users/groups/permission.
Many novice users (even some advanced users :) ) are guilty of not doing this, so when that happens you run into issues that make it seam that the modification did not take, than more often than not users wind up making a mess out of the situation trying to fix a problem that doesn’t even exists. Then when the eventually reboot... "WTF happened? $*^#ing Linux..."
Sometimes, after making a mod to part of the system and simply restarting the services effected by those mods is enough to get everything working, other times it is not. Each case/command procedure is different, also Linux being what it is, there is more than one way to skin a cat, and each way is slightly different. While the end result may be the same, the way you got there will differ and each command acts in its own way, and command defaults can vary widely!
Also do a little more reading than typing in the first command that comes back from your "How to add a user to a group?" gSearch. It is always best to refer to your distros documentation, some distros may handle some commands slightly different than other, or you may misunderstand what a command actually does if you just glance through the man pages. eg.: I want to add existing user "john" to group "others", the following two commands will accomplish this:
sudo usermod -a -G others john sudo usermod -g others john
But with subtle differences than a user may not understand. In this case,
1st command adds the group "others" to "johns" supplementary (secondary) groups.
2nd command adds and sets "johns" primary group to "others".
So technically both add "john" to "others" but in different ways. Basically what it comes down to in the end is RTFM. :) Information is your friend, If you read your may through 10,000 word manpage in 5 seconds yea you may get the command to accomplish what you want, but it also may do things you don’t know/understand that may cause you an issue down the road, and that is no ones fault but your own.