0

I am using win-kex on WSL2 trying to use the GUI, but I have a known connection problem, so I need to run this command before to successfully connect:

sudo mount -o remount rw /tmp/.X11-unix

I added this to sudoers as end line of file:

myusername ALL=(ALL) NOPASSWD: /tmp/.X11-unix mount -o remount rw /tmp/.X11-unix

But it keeps asking me for the password. Why? I don't want to avoid all sudo passwords request, just that command. But that doesn't work.

8
  • Not an answer but I don’t understand the mount command. .X11-unixshould be a file, not a mount, so why the remount?
    – doneal24
    Jan 9 at 0:41
  • Well, actually I have the same question, but that's the way it works, only when I run that command kex works. Right now I'm trying this other way: unix.stackexchange.com/questions/369852/… , but I'm having problems with file on sudoers.d
    – kapichy97
    Jan 9 at 1:11
  • And I got that 'mount' command from here: stackoverflow.com/questions/70577819/…
    – kapichy97
    Jan 9 at 1:21
  • 1
    I think you need an escaped comma between the remount and rw and why is /tmp/.X11-unix appended to the command? Do you run /tmp/.X11-unix mount -o remount,rw /tmp/.X11-unix or just mount -o remount,rw /tmp/.X11-unix? I ask because they are not the same and sudoers will not treat them the same. You need to comma separate different commands.
    – SHawarden
    Jan 9 at 3:27
  • 2
    line should be myusername ALL=(ALL) NOPASSWD: mount -o remount\,rw /tmp/.X11-unix (note escaped comma, as per man sudoers)
    – Archemar
    Jan 9 at 9:45

0

Your Answer

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