How do you get 'sudo' privilege for a program in a conda virtual environment?

Ang Jit Wei Aaron

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?

Rinzwind

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).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to install Anaconda in virtual environment of conda.

From Dev

Conda: Creating a virtual environment

From Dev

How can you "clone" a conda environment into the root environment?

From Dev

How do you sudo with xonsh?

From Dev

What environment do I get with sudo?

From Dev

What environment do I get with sudo?

From Java

How to change Python version of existing conda virtual environment?

From Dev

conda virtual environment not working with pycharm

From Dev

How do you get the name of the program using argparse?

From Dev

How do you get a program to show up in Open with?

From Dev

How to run a program with admin privilege

From Dev

How can you run QtConsole in a specific Conda environment?

From Dev

How can you activate a conda environment through a Jenkinsfile?

From Dev

How can you run QtConsole in a specific Conda environment?

From Dev

How can you activate a conda environment through a Jenkinsfile?

From Dev

How do sudo environment variables work in linux?

From Dev

How do sudo environment variables work in linux?

From Dev

How do you run a command with sudo in `~/.profile`?

From Dev

How to remove sudo privilege for default user in ubuntu

From Java

Conda install and update do not work also solving environment get errors

From Dev

Conda install and update do not work also solving environment get errors

From Dev

How do you set alias sudo='nocorrect sudo ' correctly?

From Dev

How to get pip to install packages into the virtual environment?

From Dev

How to get pip to install packages into the virtual environment?

From Dev

Conda virtual environment not changing under Windows

From Dev

cron job to run under conda virtual environment

From Dev

cron job to run under conda virtual environment

From Java

How do I prevent Conda from activating the base environment by default?

From Dev

How do I use a conda environment with mod_wsgi?

Related Related

  1. 1

    How to install Anaconda in virtual environment of conda.

  2. 2

    Conda: Creating a virtual environment

  3. 3

    How can you "clone" a conda environment into the root environment?

  4. 4

    How do you sudo with xonsh?

  5. 5

    What environment do I get with sudo?

  6. 6

    What environment do I get with sudo?

  7. 7

    How to change Python version of existing conda virtual environment?

  8. 8

    conda virtual environment not working with pycharm

  9. 9

    How do you get the name of the program using argparse?

  10. 10

    How do you get a program to show up in Open with?

  11. 11

    How to run a program with admin privilege

  12. 12

    How can you run QtConsole in a specific Conda environment?

  13. 13

    How can you activate a conda environment through a Jenkinsfile?

  14. 14

    How can you run QtConsole in a specific Conda environment?

  15. 15

    How can you activate a conda environment through a Jenkinsfile?

  16. 16

    How do sudo environment variables work in linux?

  17. 17

    How do sudo environment variables work in linux?

  18. 18

    How do you run a command with sudo in `~/.profile`?

  19. 19

    How to remove sudo privilege for default user in ubuntu

  20. 20

    Conda install and update do not work also solving environment get errors

  21. 21

    Conda install and update do not work also solving environment get errors

  22. 22

    How do you set alias sudo='nocorrect sudo ' correctly?

  23. 23

    How to get pip to install packages into the virtual environment?

  24. 24

    How to get pip to install packages into the virtual environment?

  25. 25

    Conda virtual environment not changing under Windows

  26. 26

    cron job to run under conda virtual environment

  27. 27

    cron job to run under conda virtual environment

  28. 28

    How do I prevent Conda from activating the base environment by default?

  29. 29

    How do I use a conda environment with mod_wsgi?

HotTag

Archive