How to install app with sudo rights (as a standard user)?

I was wondering how to install Bleachbit with a standard user account (no sudo rights) but with sudo-rights enabled just for this application, without altering the account type globally?

Hi @Kweenie67,

Look at the sudoers configuration. I think, specifically, providing a custom configuration in /etc/sudoers.d

I suspect there is an option with polkit, but I know nothing about that.

Hope this helps!

Edit:

You’d have to install it as root, but then using the configuration you can set sudoers not to as for a password if you run the executable with sudo.

Thx for the tip! :wink:

This sudoers.d map is marked with a black cross through it. It can only be opened as root.
Should this be the recommended way to change it?

Isn’t that a risky move?
I mean, superuser privileges are required in order to modify system files. And considering BleachBit can be quite damaging if used incorrectly – talking from experience – i’d be personally even less inclined to allow a user to run it as a superuser if they aren’t even allowed to install/update/remove packages…
:face_with_raised_eyebrow:

That being said, as a user you can download any Linux application, put it in a personal folder, and run it from there, with or without superuser rights. It won’t be “installed” per se – you only need to delete the installation folder to “uninstall” it – but it doesn’t need superuser privileges to do so.

:thinking: Is your suggestion similar with the ‘execute as instant app’, as used in Adroid?
The non-installed app runs from the cloud, but only with the absolutely necessary parts, which are deleted when closed/ended?

The main reason why I would prefer a installed system application in stead of an ‘instant app’ is mainly the matter of control. I take some risks normally for granted.
But, when your Manjaro system works from the cloud, your suggestion is far way desirable.

I am not familiar with Android instant apps, but what i mentioned is not that at all.

I talk about an application in the most basic sense.
An application is merely an executable file, most often with (many) resources files and libraries. When you install an application on your system, you put those files at a defined place on your drive. Then you can run that application from the executable file.
When you use an installer – or a package manager on Linux – the place where it will be installed to is pre-defined, and some information is added to the system in order to allow you to run that application without needing to look for the executable file. That is how you can launch an application from an application menu, a launcher on your desktop, or from a single command in the terminal.
In Linux, the package manager commonly install an application in a folder owned by root, not the user. This is why you need superuser privileges to install and update anything through the package manager. But that is merely the “standard” way to do things. You can still “install” an application manually (see above), without needing superuser privileges, but also without the benefits of the package manager.
In all those cases, the application is fully on your drive. Thus not in the cloud.

login as root…

# EDITOR=nano visudo

go to the bottom of the file…

add the following command…(substitute your {user $} for username below )

username ALL=/usr/bin/pamac,/usr/bin/pacman,/usr/bin/pacman-mirrors

hit Ctrl+o to save /etc/sudoers.tmp
hit Ctrl+x to exit nano

exit from root prompt

then…

[user] $ sudo pamac install app-name

or

[user] $ sudo pacman -S app-name

This is exactly what I was looking for. Thanks for sharing.

1 Like

Alternativ:
look for the bleachbit.desktop file
(/usr/share/applications/org.bleachbit.BleachBit.desktop)
…
(kdesu must be installed):
change the line with “exec = [command]” ==> exec = kdesu [command]
This will open a requester asking for password…
(and start the app with sudo rights)
.
Last: write down what you have done to a cheat-sheet :innocent:

1 Like

Hi, I was wondering and I must absolutely be sure…
Are we (still) talking about the file the file ‘sudoers.d’ (/etc/sudoers.d) ?

Thank you for this simple but effective solution. :smiley:

/etc/sudoers.tmp

This resource should only be used for things like pacman-mirrors and veracrypt but not for anything that would install software, or modify permissions.

That’s what I already thought. Thx for the confirmation.
But definitely a creative solution for my (yet fixed) problem.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.