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

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

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

Okay