I'm trying to make a web interface for a game server.
I have a user/group "gameserver" that has game files and configurations (not a sudoer). And a user/group "www-data" that you all know is for web application.
Now I've unfortunately seen posts of people asking or suggesting adding www-data to "sudo" group, to allow it to modify files elsewhere. A very bad practice for security reasons.
I want to enable www-data to modify files inside files/folders of user "gameserver" without "root" privileges.
There are several ways of doing it as far as I know:
- Change file/folder permissions to be read/write globally.
- Change file/folder group ownership to "www-data".
- Add user "www-data" to group "gameserver".
The first two would require changing permissions or ownership for every new file or folder being newly created. Therefore, the last way seems the most plausible. However, after executing:
usermod -a -G gameserver www-data
to add user "www-data" to group "gameserver", I can no longer SSH to user "gameserver". And get an error:
Permission denied (publickey).
This post seem to have a similar issue: SSH broken pipe error after adding user to group
But does not really solve the issue.
Why does adding another user to my user group prevents me from accessing my user via SSH? And how can I solve this issue?
Note that "www-data" was indeed able to write to files belonging to user "gameserver".
To reverse the effect, I SSH to "root" and execute:
gpasswd -d www-data gameserver
To remove user "www-data" from group "gameserver"
As Ryan Babchishin indicated in the 1st comment, it is working for him. I tried on another server and it works. This problem is specific to OVH servers at the moment. They indicated that they are using a custom kernel in response to an earlier issue where I was unable to use SystemV commands to start, stop or restart a service. I filed another ticket now. But still don't understand what does this has to do with Linux permissions.