plugins icon indicating copy to clipboard operation
plugins copied to clipboard

[Feature] mount.yazi: Elevated privilege

Open andriy-git opened this issue 7 months ago • 3 comments

yazi --debug output

Yazi
    Version: 25.4.8 (Nixpkgs 2025-04-08)
    Debug  : false
    Triple : x86_64-unknown-linux-gnu (linux-x86_64)
    Rustc  : 1.86.0 (05f9846f 2025-03-31)

Ya
    Version: 25.4.8 (Nixpkgs 2025-04-08)

Emulator
    TERM                : Some("tmux-256color")
    TERM_PROGRAM        : Some("tmux")
    TERM_PROGRAM_VERSION: Some("3.4")
    Brand.from_env      : Some(Ghostty)
    Emulator.detect     : Emulator { kind: Left(Ghostty), light: false, cell_size: Some((9, 17)) }

Adapter
    Adapter.matches    : Kgp
    Dimension.available: WindowSize { rows: 29, columns: 212, width: 1908, height: 493 }

Desktop
    XDG_SESSION_TYPE           : Some("wayland")
    WAYLAND_DISPLAY            : Some("wayland-1")
    DISPLAY                    : Some(":1")
    SWAYSOCK                   : None
    HYPRLAND_INSTANCE_SIGNATURE: None
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

Variables
    SHELL           : Some("/usr/bin/zsh")
    EDITOR          : Some("vim")
    VISUAL          : Some("vim")
    YAZI_FILE_ONE   : None
    YAZI_CONFIG_HOME: None
    YAZI_ZOXIDE_OPTS: None
    FZF_DEFAULT_OPTS: None

Text Opener
    default     : Some(OpenerRule { run: "${EDITOR:=vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })
    block-create: Some(OpenerRule { run: "${EDITOR:=vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })
    block-rename: Some(OpenerRule { run: "${EDITOR:=vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })

Multiplexers
    TMUX               : true
    tmux version       : 3.4
    tmux build flags   : enable-sixel=Unknown
    ZELLIJ_SESSION_NAME: None
    Zellij version     : No such file or directory (os error 2)

Dependencies
    file          : 5.46
    ueberzugpp    : No such file or directory (os error 2)
    ffmpeg/ffprobe: 7.1.1 / 7.1.1
    pdftoppm      : 25.05.0
    magick        : 7.1.1-47
    fzf           : 0.62.0
    fd/fdfind     : 10.2.0 / 9.0.0
    rg            : 14.1.1
    chafa         : 1.14.5
    zoxide        : 0.9.7
    7zz/7z        : 24.09 / 23.01
    jq            : 1.7.1

Clipboard
    wl-copy/paste: 2.2.1 / 2.2.1
    xclip        : 0.13
    xsel         : No such file or directory (os error 2)

Routine
    `file -bL --mime-type`: text/plain


See https://yazi-rs.github.io/docs/plugins/overview#debugging on how to enable logging or debug runtime errors.

Please describe the problem you're trying to solve

I tried using mount plug in and was able to mount some drives and others no. I tried manually mounting a drive and needed to run sudo.. I downloaded yazi the nix-env way and have it set as user only. So if running sudo yazi doesn't find yazi making it harder to start yazi with root privileges.

Would you be willing to contribute this feature?

  • [ ] Yes, I'll give it a shot

Describe the solution you'd like

I was wondering if something could be added to be able to elevate privilege if it is required

Additional context

No response

Checklist

  • [x] I have searched the existing issues/discussions

andriy-git avatar May 26 '25 14:05 andriy-git

mount.yazi uses udisksctl on Linux to mount disks, and according to man udisksctl:

       This program does not assume that the caller is the super user - it is
       intended to be used by unprivileged users and authorizations are checked
       by the udisks daemon using polkit(8). Additionally, this program is not
       intended to be used by scripts or other programs - options/commands may
       change in incompatible ways in the future even in maintenance releases.
       See the “API STABILITY” section of udisks(8) for more information.

So, it should not require sudo, and I've tested several different devices, and none of them required sudo either.

My question is: under what circumstances, and why, would sudo be needed?

sxyazi avatar May 26 '25 16:05 sxyazi

Here is screenshot with everything unmounted: Image

Here is a screenshot of a mountable drive: Image

Here is a screenshot of the drive I'm trying to mount but won't work, but does work with sudo mount command: Image

Could it possibly have something to do with ntfs?

andriy-git avatar May 26 '25 17:05 andriy-git

Well I tried udisksctl and maybe it is because of the file system. Take a look:

Image

andriy-git avatar May 26 '25 21:05 andriy-git