ntdll: add a warning about running wine as root (resend)

Ben Klein shacklein at gmail.com
Mon Feb 9 09:54:08 CST 2009


2009/2/10 Steve Brown <sbrown7 at umbc.edu>:
> On Mon, 9 Feb 2009, James Mckenzie wrote:
>
>> Alexandre Julliard <julliard at winehq.org> wrote:
>>> Please explain how running as root will screw their Wine directory. If
>>> that's really true, surely it should be fixed instead of simply throwing
>>> out a warning and proceeding.
>>
>> New wine installation:
>>
>> su (no dash so root's environment is not picked up)

This would not cause a problem, as $HOME is set to the home directory
for root. The problem is mostly when the user runs wine (often winecfg
specifically) using sudo.

In the case of "sudo wine" whatever, $HOME is the originating user's
home directory, and `id -u` is 0. So this means that root-owned files
will appear in $HOME/.wine (assuming no WINEPREFIX is set).

In the case that there is already a .wine owned by the original user
before running "sudo wine" whatever, and that user then runs an
application as normal user after the permissions have been stuffed
with, it *can* (but probably won't) cause weird problems with some
files (possibly including registry) not being correctly written to.
The only reason why an existing .wine is required for this case is
because of the UID owner test in wine.

>> wine notepad
>> install various programs and use them.
>> exit
>>
>> User logs in a second time after learning how to properly use Wine.
>> Attempt to do anything with Wine in user space.  Cannot do due to permissions problems.
>>
>> The solution:
>>
>> sudo rm -rf .wine
>
> Wouldn't a better solution be `sudo chown -r me:me .wine`  ?

This would, in most cases, fix it and have no side-effects. But if an
application was able to run as normal user when some permissions are
set as root-owned in .wine, it could cause problems.

Should we worry about this problem? Probably not, because a "chmod
u-w" on a few files would have the same effect. The most important and
useful thing to attempt is proper education. Essentially "don't run
wine as root or using sudo" for all the various reasons.

Also note that there is little-to-no reason to run wine as root, and
that is even further reduced under kernel 2.6.24 and higher where
POSIX File Capabilities were introduced. Should we prevent it? No,
that's not in keeping with *nix style. Should we provide a warning?
Couldn't hurt.

Biggest problem I see at this stage with providing a warning for
running as root is, should wine continue or stop on such a warning? In
other words, if I trigger the "running as root" warning, should I have
to confirm that it's what I want to do somehow, or should I get the
warning but wine continue to run?



More information about the wine-devel mailing list