I want to install ansible and docker in ubuntu in the specific user

Please explain what all permissions need to be given to do any activities in the Specific user ,
i have already edited in sudo visudo file and and the user below the root .

But still why do we need to use sudo as part of command line in the specific user ,
for example

sudo apt-get update ansible -y is working
but without sudo its not getting installed .
Please let me know what is the solution

Which lab is this? A link would be very helpful in answering your question.

It is likely that you incorrectly edited the sudoers file (visudo) and root permission is not actually granted to the user account.

You need an entry like

myuser ALL=(ALL) NOPASSWD: ALL

for your user.

Hi i did , As you said below are the images .

please let me what action should i take

entry :

Need to understand how we can execute any commands in the specific user other than root, without sudo in the beginning ,
If it is to be used , then why.


If you see this , with sudo output is coming , but without sudo this error is repeated .

apt-get needs to be run as root.

Ah - so it does!

apt-get checks the real not effective user ID of the user executing the program. This means it still won’t work for users granted root permissions in the sudoers file - you actually do have to be root, which means sudo

This is because access to a package installer is a security risk. A bad actor could use it to install packages with known security vulnerabilities to open back doors.

Just to complement: As the KK team says, to install the packages with apt you will need always to have root level permission. You can make you user to not need a password when you are using sudo also, but sudo make you have root levels in the operation. There are other ways to install programs like Flatpak and Snaps, which install the software in an isolated environment (Not using the libraries of the system in long story short) . In some cases you can install without sudo like this: flatpak install --user “NameOfTheApp” , I’m not sure if there is an ansible flatkpak version, but I also recommend to install it system wide using apt to avoid config issues and more.

Some programs in Linux like Docker or qemu can make you use the program without using sudo, in many cases you need to edit the /etc/passwd to add your user to the group that the application need. Sometimes this could make a security concern (Docker says that in the documentation for example), but is a way to use some programs without need of sudo.

I think that’s the long story short of “How to use programs in Linux without using root in the process” hope it helps you @shyam.cbse

Cheers