Saturday 11 February 2017

How to use sudo without entering password


If you want, you can run anything that must run with 'sudo' command but without entering the password. This can be done by modifying the sudoers file on ubuntu.

Running sudo without password may sounds crazy, this can lead to serious security issue, but there some cases that doing this is necessary.

For example you have a driver for a certain device that need to run with sudo command in order for the device to work. You don't want entering password every time you work with the device right? specially when you call it from another application.

To make a user on ubuntu can run sudo without password, we need to add 'NOPASSWD' for that user on sudoers file (/etc/sudoers). There is a dedicated command for editing sudoers file, it's called 'visudo'.

How to make a user run sudo without password
Let's say i want to make user called 'kernelpanic' to be able to run sudo without password, so this is what i do:

  • open command line and run this to edit sudoers file
  • sudo visudo
  • under 'User privilege specification', add the following code
  • kernelpanic ALL=(ALL) NOPASSWD: ALL
  • save and exit
  • the user 'kernelpanic' should be able to run sudo without password

Simply remove 'kernelpanic ALL=(ALL) NOPASSWD: ALL' on sudoers file, if you want user 'kernelpanic' to become a normal user again.


Harry

Author & Editor

A technology enthusiast and addictive blogger who likes to hacking tricks and wish to be the best White Hacket Hacker of the World.

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.