0

Hi I'm new to linux and currently I'm using ubuntu as my linux distribution. Right now I'm confused about user in ubuntu and search online about it. I found article about it in digital ocean that says "This is done to separate functional privileges. That way, if an account is compromised or misused, the affect will be isolated.".

So not long time ago I heard about virtual environment and understand it as an isolated environment so what happens in that venv has nothing to do with outside of it.

According to what I understand, can I say that user in linux (especially ubuntu) has same function as an virtual environment?

1 Answer 1

0

venv is a concept of the Python programming language. The problem it solves has to do with dependencies. A Python program usually depends on other programs, which reside in files named libraries. For a Python program to work, the necessary libraries need to be installed on the computer. Installed libraries are then shared by all Python programs.

Some Python programs don't only need libraries, but certain versions of those libraries. This can lead to version clashes - program 1 needs version 10 of library xyz, and program 2 needs version 11 of the same library. To avoid such clashes, one can set up a virtual environment or venv, which is a filesystem directory tree that contains the libraries a program requires.

A user, on the other hand, has nothing to do with Python, libraries or library versions. A user only has access to certain files in the system, which limits the damage that user can cause. The exception is the superuser, almost always named root, which has access to everything.

There is a relationship between users and venvs. A non-root user can't overwrite Python libraries that are shared among all users. However, the user can create a venv, where it has full read and write access to all files, which allows it to create and update Python libraries.

1
  • So if I'm user 'A' that created venv1, that venv is belong to user 'A'. That said user 'B' doesn't have access to venv1, is that right? Commented Jan 25, 2021 at 10:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .