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

[feat] How to Run Tauri's Application in Root Mode #6807

Closed
zzpp515630 opened this issue Apr 27, 2023 · 7 comments
Closed

[feat] How to Run Tauri's Application in Root Mode #6807

zzpp515630 opened this issue Apr 27, 2023 · 7 comments

Comments

@zzpp515630
Copy link

Describe the problem

Excuse me, if you use the deb package compiled by tauri to run in ubuntu, it can be opened like GParted after installation, and you will be prompted to run with root privileges. Then, enter the password and run the program. Open in non command-line mode.

Describe the solution you'd like

Requires sudo to run

Alternatives considered

No response

Additional context

No response

@amrbashir
Copy link
Member

Not sure what you want to be honest, could you explain more please? Do you want to forbid using your app unless it is opened using sudo from command line?

@zzpp515630
Copy link
Author

For example:pkexec my application。My application requires root access to system resources. Want to start and access through a desktop shortcut. Applied to deb packaging method

@zzpp515630
Copy link
Author

The current solution is to modify desktop shortcuts, but this is not the final solution。
example:
[Desktop Entry]
Categories=
Comment=.......
Exec=sudo /usr/bin/my-application
Icon=application-icon
Name=application-name
Terminal=true
Type=Application

@amrbashir
Copy link
Member

For more info see https://wiki.archlinux.org/title/Running_GUI_applications_as_root

@amrbashir amrbashir closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2023
@zzpp515630
Copy link
Author

Thanks...

@cosoc
Copy link

cosoc commented Jun 25, 2023

When developing some applications that require administrator privileges, we need root to run the software in our development environment. This is how I do it

The purpose is to let the sudo command maintain the current environment variables

sudo -E env PATH=$PATH  yarn run tauri dev

@xueweiwujxw
Copy link

This is my solution

[Desktop Entry]
Categories={{{categories}}}
{{#if comment}}
Comment={{{comment}}}
{{/if}}
Exec=sh -c "pkexec env DISPLAY=$(w | grep $(whoami) | awk '{print $3}') XAUTHORITY=/run/user/$(id -u)/gdm/Xauthority {{{exec}}}"
Icon={{{icon}}}
Name={{{name}}}
Terminal=false
Type=Application

with tauri.config.json

      "deb": {
        "depends": [],
        "desktopTemplate": "./templates/main.desktop"
      }

It works on Ubuntu 20.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants