DEV Community

Daniel Pepuho
Daniel Pepuho

Posted on • Edited on

2 1

How to enable passwordless sudo in Linux

I can show you many steps to configure passwordless sudo for specific user:

1.open your terminal and type this to add new user:

$ sudo adduser ansible
Adding user `demo' ...
Adding new group `demo' (1004) ...
Adding new user `demo' (1004) with group `demo' ...
Creating home directory `/home/demo' ...
Copying files from `/etc/skel' ...
New password: 
Retype new password: 
passwd: password updated successfully
Changing the user information for demo
Enter the new value, or press ENTER for the default
    Full Name []: 
    Room Number []: 
    Work Phone []: 
    Home Phone []: 
    Other []: 
Is the information correct? [Y/n] y
Enter fullscreen mode Exit fullscreen mode

2.after that type:

$ sudo visudo
Enter fullscreen mode Exit fullscreen mode

3.go down to the bottom, then add this to assign a new user become sudo:

ansible ALL=(ALL) NOPASSWD:ALL
Enter fullscreen mode Exit fullscreen mode

4.done, now you have new user, that will able to execute sudo command without providing a sudo password.

N/B: in Debian you must install sudo:

$ apt install sudo

Enter fullscreen mode Exit fullscreen mode

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay