Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/run/user/$UID has 0755 access permissions by default #346

Open
e-nikolov opened this issue Nov 30, 2023 · 4 comments
Open

/run/user/$UID has 0755 access permissions by default #346

e-nikolov opened this issue Nov 30, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@e-nikolov
Copy link

e-nikolov commented Nov 30, 2023

Bug description

On regular NixOS and other distributions /run/user/$UID has 0700 access permissions but on NixOS-WSL it has 0755. This causes problems for some programs like 1password's CLI op which produces an error like: XDG_RUNTIME_DIR file permissions too open, refusing to use

This might be a WSL issue since Ubuntu on WSL also has it set to 0755. Also manually changing the permissions via chmod only lasts until reboot. Is there a way to automatically set the permissions in NixOS-WSL?

@e-nikolov e-nikolov added the bug Something isn't working label Nov 30, 2023
@SuperSandro2000
Copy link
Member

IIRC this is intended, see NixOS/nixpkgs@03e79e9

@SuperSandro2000 SuperSandro2000 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 1, 2023
@e-nikolov
Copy link
Author

This commit is from a PR that isn't merged yet and it discusses /run/dbus, not /run/user/$UID.

On my purely NixOS system I have these permissions:

❯ stat -c %a /run/user/1000
700
❯ stat -c %a /run/user
755
❯ stat -c %a /run/dbus
755

While on my NixOS-WSL system I have these:

❯ stat -c %a /run/user/1000
755
❯ stat -c %a /run/user
755
❯ stat -c %a /run/dbus
755

@aidan-mundy
Copy link

FWIW, this is also the case on the default Ubuntu WSL image, and is also causing issues for me with 1password

@e-nikolov
Copy link
Author

Initially I had a service to fix the permissions when 1Password starts up inside WSL:

  systemd.user.services = {
    _1password_gui_autostart = {
      Unit = { Description = "1Password GUI Autostart"; };

      Service = {
        Environment = "DISPLAY=:0";
        ExecStartPre = "${pkgs.coreutils-full}/bin/chmod 700 /run/user/1000";
        ExecStart = "${pkgs._1password-gui}/bin/1password";
        Restart = "always";
      };
      Install.WantedBy = [ "default.target" ];
    };
  };

But eventually, it made more sense to configure WSL to use the Windows version of 1Password so that I don't have to run 2 instances:

{ config, pkgs, lib, ... }: {
  programs.git.extraConfig.gpg.ssh.program = "op-ssh-sign-wsl";
  programs.git.extraConfig.core.sshCommand = "ssh.exe";
  home.shellAliases = {
    ssh = "ssh.exe ";
    op = "op.exe";
  };
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants