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
💡 One last tip before you go

DEV++

Spend less on your side projects

We have created a membership program that helps cap your costs so you can build and experiment for less. And we currently have early-bird pricing which makes it an even better value! 🐥

Check out DEV++

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay