Bugzilla – Bug 16343
restart server can't work with --user/--group
Last modified: 2011-08-26 15:01:37 UTC
On any Unix, when the server is started with --user and/or --group, it won't be able to restart on its own. The code will simply refuse to continue as it is not running as root. I had a try at a patch that introduced a --restart flag when the server was being restarted, and allowed the code to skip changing the credentials when the following conditions were met: - the server was passed --restart - $> is equal to the target uid - $) is equal to the target gid. However, the server ran into issues with mysqld further on; I haven't tried very hard, but I might revisit it later. The patch was also testing for the --restart thing when trying to write its pid to $pidfile, as there is no point in doing that when the server has exec()'d over itself.
what kind of restart are you talking about?
The kind that is initiated by main::stopServer(1). Typically happens when you change the active state of a plugin, in my experience.
*** Bug 16921 has been marked as a duplicate of this bug. ***
Created attachment 7413 [details] Tentative fix I'm confirming this bug on my QNAP. I've attached a fix that will ensure changeEffectiveUserAndGroup() won't be called if the user launching the server is already the one specified with --user. I've not checked thoroughly, but the effective group should be preserved. By the way, I can see an obvious error in the original code: defined($user) eq "root" *CANNOT* be true. Wasn't sure what it was supposed to do, so left the test there, however. Maybe that's why I had the same problem on my ReadyNAS?
Confirming the bug, by the way.
And the bug's still there in 7.6.1 r33110.
Confirmed that Seb's patch was both necessary and effective on 7.6.1 RC3 running on a Buffalo Linkstation. Without the patch, SBS fails to restart when enabling or updating a plugin.
Created attachment 7429 [details] Cleaner patch This one looks definitely cleaner.
== Auto-comment from SVN commit #33230 to the slim repo by agrundman == == http://svn.slimdevices.com/slim?view=revision&revision=33230 == Fixed bug 16343, patch from S?\195?\169bastien Ph?\195?\169lep to allow restarting to work with user/group switches