1

As with the title, how can I run a program installed within a conda environment with sudo privileges?

This thread(sudo: conda: command not found) mentioned that conda commands cannot be granted super user privilege. But I need this particular program to be granted full write and edit access. I tried changing the permission of the folder/program in question but it gets automatically reset back to just 'access only' permission every time.

Any ideas how I can circumvent this problem?

PRATAP
  • 22,460

1 Answers1

2

But I need this particular program to be granted full write and edit access.

No, you do not. You need write and edit access to a specific location for your conda to store a file so an action can be started. And conda by default installs in your home with your user as user and group so that place is already created for you. That is all you need in regards to permissions for conda. Anything else is a security issue.

All other actions you need to do should be done from a script on your system disconnected from your conda environment.

A very basic example:

  1. from conda you create a pidfile in your conda home (/home/user/.conda/pid). You can use those to store data in this file that you want to process.
  2. you create a systemd service that scans for new pid files added to the system.
  3. the systemd service starts a script (as root) that scans the pid file and does what needs to be done. Mind that this also can create a new file for conda to pick up that holds the result of this.

2 and 3 can also be a cron job (through crontab or /etc/crontab) or a directory watcher (inotify or with Python watchdog).

Rinzwind
  • 299,756