12

So I was running about trying to install something in wine when I encountered the suggestion to use sudo to get administrator privileges. That's when I got the above message

~/.wine is not owned by you

Reading up I quickly realised why this message appears and that trying to sudo wine is A REALLY BAD IDEA.

So I didn't do anything further and don't intend to ever sudo wine again. My question is, because I received this block, am I safe? Or do I need to remove all of wine because I did?

  • 6
    Is it really /.wine or ~/.wine? I'm pretty sure there shouldn't be a .wine directory right under the root. Or is there some chrooting I'm not aware of? – John WH Smith Mar 20 '17 at 17:38
  • As mentioned in the comments, don't ever run Wine as root. On a related point, if you ever need to run a GUI app (e.g. gedit) as root, please remember to use gksudo instead of sudo. This protects your home folder from such problems. – Paddy Landau Mar 28 '17 at 9:28
20

Wine expects that $WINEPREFIX (which defaults to ~/.wine) be owned by you. When you run wine with sudo, ~/.wine is owned by you, but wine is running as root. Hence the error. Wine immediately quits when this happens, so you don't need to worry, no damage was done.

You don't need to reset ownerships as in Zanna's answer (this particular run of wine didn't make any changes), but that's usually harmless.

Note that Wine applications have as much access to the system as the user they run as, so running Wine as root, as you have realised, is dangerous.

  • +1 for the answer. Do not use sudo wine application.exe, just wine application.exe – Sachith Aug 1 '17 at 11:06
16

Nothing too terrible has happened ;) root might have become owner of the wine config directory, that's all.

You can fix any potential issues by making sure you are the owner of that directory. When logged in on your normal user account, run (typing very carefully):

sudo chown -R $USER: ~/.wine
  • 13
    Whoa! It's very plausible that there are things in my $HOME that I don't own! For instance, how about that symbolic link to "$SHARED_WALLPAPERS" or /usr/bin? Please don't advise chown -R "$USER:" "$HOME". – wchargin Mar 20 '17 at 13:04
  • 1
    @Zanna merely creating a link like that doesn't let you change ownerships on it (or edit files in it), but the sudo here makes it tricky. – muru Mar 20 '17 at 13:15
  • 5
    @wchargin chown -R does not descend into symbolic links. (You may have seen something in the manpage about the default behavior being to dereference symbolic links; this refers to links specified on the command line rather than those found via recursion - the options for recursion are further down) – Random832 Mar 20 '17 at 13:30
  • 3
    @Random832 still a problem for bind mounts and the like. – muru Mar 20 '17 at 13:32
  • 5
    @muru I think at that point we're talking about setups so unusual that the person who made them probably knows what they're doing. – Random832 Mar 20 '17 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.