Sudo without password on Ubuntu

sudo visudo

Add this line at the end (change “jerome” to your username):


Ctrl-X to leave, save your changes, and you're done!


I have tried the above in an Ubuntu OS. It does not work and even with many other variations made to the sudoers file, I am always asked for a password when I execute sudo command.
Sir Percy
Dec 30, 2008
Which version of Ubuntu are you using? It flawlessly works from at least 7.04.
Jérôme Jaglale
Dec 30, 2008
8.0x Server Version I will try your fix again on Friday. thanks
Sir Percy
Dec 30, 2008
I overlooked the fact that it must be at the end of the file. In my version, the last line of code gives all users in the admin group root access but with a password required. If your line precedes this, then the effects are undone by the last line of code because my user login is also a member (unintentional) of admin.
Sir Percy
Dec 31, 2008
Hi, i tried previous command and it works. I have Ubuntu Jaunty 9.04 alpha 6
Mcfee - Pablo Andres Diaz A.
Mar 24, 2009
hai its working fine in Kubuntu 8.04 sudo visudo jaleel ALL=NOPASSWD: ALL save and reboot thanks a lot
Jul 9, 2009
'ya dont need to reboot..
Jul 29, 2009
%sudo ALL=NOPASSWD: ALL will also help... For me helped.
Nov 10, 2009
Not working 4 me man.I did exactly what you wrote.Here as you can see.Nothing happened. # User privilege specification root ALL=(ALL) ALL caglar ALL=(ALL)NOPASSWD: ALL # Uncomment to allow members of group sudo to not need a password # (Note that later entries override this, so you might need to move # it further down) # %sudo ALL=NOPASSWD: ALL # Members of the admin group may gain root privileges ?min ALL=(ALL) ALL
Dec 31, 2009
works on Karamic 9.10. Thanks....
Jan 14, 2010
caglar - you didn't place the "caglar ALL=(ALL) NOPASSWD: ALL" at the END OF THE FILE. It works for me under Karmic 9.10. (What I actually did was place the %sudo line at the end of the file, and did a "sudo adduser sudo")
Jan 21, 2010
This is awesome, I tried it in Linux Mint 9 (Pretty much Ubuntu 10.04 with closed source packages, and a custom menu), and it works flawlessly. I hope it also works with package installs and programs like gparted.
May 22, 2010
but, but, why? you are destroying the nice security that it brings :S
Dr Dolme
Jun 22, 2010
Cant download anything or play voice messages on computer due to needing my password when I forgot a long time ago
carl Lewis
Nov 15, 2010
This doesn't work! What are you talking about? HA! You DON'T know what you're talking about, you big fat $%^#ing $%^!

Nov 27, 2010
WOW! THAT person has obviously gone insane! IT'S JUST A COMPUTER!
By the way - Yes, that's my real name!
Julita Altagracia Maria Teresa Alvarez Tavares Perello Espaillat Julia Perez Rochet Gonzalez
Nov 27, 2010
Correct. Eliminating sudo is the biggest security threat you can ever do to your system; especially a server. Awful practice.
Jan 4, 2011
Security? Maybe if your brother is attacking your system by slipping in while you go to the bathroom. If an attacker has access to YOUR account and you have root permission you are already screwed. What no password sudo gives to a desktop is that you can ease the burden of administration slightly. For a multi-user system it is a bad idea since the commands you issue as root will affect the work of others. Thus, the password prompt is a fine indicator that you should think twice.
Jan 15, 2011
The password prompt is indeed a good indicator of the severity of your actions. Nullifying the use of a password is a security risk. While entering your password every time is cumbersome, it is possible to set the password timeout higher (add Defaults passwd_timeout=10 to /etc/sudoers using the command sudo visudo)*. This would dissuade intrusion, unless the attacker has physical access. No measure of security can overcome PEBKAC.

*this tip from ubuntuforums thread 229309
Jan 27, 2011
thanx cafehunk for your suggestion! I was stuck with this issue for a while..
Mar 8, 2011
works in ubuntu 11.04 beta2
Apr 25, 2011
Consider keeping an open shell/editor session su'd as root while you experiment so that you don't accidentally lock everyone out of being able to sudo (and consequently have no way of reverting the change!). #LFMF
May 2, 2011
May 17, 2011
Jul 17, 2011
Although there is a small security issue with removing passwords from sudo, there is a much bigger security issue... passwords themselves. Password re-use is a bigger problem than password entrapy. Most people have less than 5 passwords but use 100+ websites and other PCs.

My home PC has a password to log in with a keyboard, but as soon as I find a way to do log in with a dongle, I'm going to remove password access all togeather. All servers such as SVN and PostgreSQL on my PC are OS user based.
Jul 21, 2011
Works fine........ gr8 Tip. Helped me alot
Aug 5, 2011
faltou antes chmod +w /etc/sudoers
acrecenta a linha
e chmod-w /etc/sudoers
Aug 8, 2011
Works with Ubuntu 11.04 Desktop i386.
Aug 11, 2011
PS remember to change it back, otherwise you have a security issue. If you read this tip in the wrong place maybe your IP address and who knows your login name as well are now out there.
Would you leave your hall door open while playing in the back garden with your dog? - hm, maybe you don't have a garden; maybe you don't have a dog ; maybe you don't have a hall door :-)
Aug 11, 2011
The technique work on OS X, too. Maybe it works on all *nix-like OSes with /etc/sudoers files? Anyway, OS X has prototype lines in the file clearly commented like, "Uncomment to allow all people in group wheel to run all commands". There are other ones for per user, etc. Makes it easy to eliminate security. Who cares about security, anyway? Don't you leave your front door open? i do.
Sep 12, 2011
Very important! Add it at the END of the file!

It doesn't work if you add it at the top.

Nov 13, 2011
thank works fine
Nov 15, 2011
Thanks, very helpful. I use an Ubuntu virtual machine to record screencasts and with this I don't have to enter my password all the time during recordings.
Dec 13, 2011
NEVER edit /etc/visudo directly, as charles suggested. If you do something wrong, which creates a syntax error, then you can't use sudo to change it back... Use visudu to change that file, it checks for syntax errors and warn you if needed. (One syntax error is if there is no empty line after the last line, but there are also other syntax errors.)

A better idea is to specify those commands you want to run without password, and have sudo ask for password for other commands.

username ALL=NOPASSWD: /usr/bin/apt-get
Dec 24, 2011
No a member just stumbled accross the thread & had to give props for the only honesy accurate advice Ive heard yrt ! Some people seem to think there GOD of the info of somethin ? We all started somewhere ~ Cheers
Jan 24, 2012
walterpops01@aim is my most reg e.mail if either of you wanna pass along any more insightful advice of reccommendations ? My nex project is a full WIPE, SCAN, PARTITION, & Running several O.S. and obviouly some more indepth details I know I need advice !
Jan 24, 2012
????? ???? ??? ??? ????????
Thank you very much for this information
Feb 1, 2012
Works perfectly!
Linux mint 13 MATE
Jul 15, 2012
It worked for me .. thanks
Aug 5, 2012
@visudo : that never works for me. it's NOPASSWD=ALL or nothing.
Sep 12, 2012
Or you could just do what I did and write a package managing script that injects NOPASSWD=ALL into /etc/sudoers for the duration of functions then changes /etc/sudoers back to original upon exit.
Dec 31, 2012
I was able to run it on Ubuntu 12.10 to do you should

1. create a script inside the directory /etc/sudoers.d and name the file as XX_someName where XX is a numeric value. Eg 99_aptget
2. inside the file include the line
someUser ALL = NOPASSWD: /usr/bin/apt-get

3. change the mode to 0440
eg. chmod 0440 99_apt_get

You should now be able to run it.
Feb 19, 2013
Not working for me :-( How do you use it? I set the user dimi, but when I login via ssh I cannot sudo.. :-(

bash-4.1$ sudo --help
bash: sudo: command not found

please help
Mar 6, 2013
I think I just made it with another user. I still dont know why the user dimi cannot execute the sudo comand but the other user does. However, this solution is OK for me so far.
Mar 6, 2013
this works for all versions!@!@!@!@it will remove the password on unbuntu and linux!@@!!@!@!@!@it worked it worked!!@!@@!!@!@!@!@!@ its sudo><#> 4.3 version 32.1 chirrouteantbusybox4.321ip:ALL open close sudo=false routeinre6ip3.32

type that in and replace chirroute with ur username,once done with that switch the parameters to your ip and dns listing. ANd it should work. your all welcome :)!@@!!@!@!@!@!@!@!@

Jun 6, 2013
how do i get ubuntu12.10 off a dell inspiron 1525 laptop with a password . what command do i type in after " grub>"?
Nov 23, 2013
It works!
Santiago J. Valls
Dec 5, 2013
Marc Christenfeldt
Mar 13, 2014
It worked for me, running Lint Mint 13 =)

Apr 24, 2014
12.04, just add the line at the end.

Thanks alot

Jun 14, 2014
Still works wonderfully on latest ubuntu.
Zeus Of Lightning
Jun 24, 2014
Works like a charm in 14.04 Trusty
Dale Harries
Jul 29, 2014
It does not work for me. I do not understand all the tech talk. I was content with XP but I let a Kubuntu disciple talk me into installing Kubuntu. Now I get password requests all the time. I am not worried about security. I just want to get rid of the password requirement. My alternative if no one can provide a simple procedure is to use a hammer.
John Byrne
Jul 30, 2014
This is not wise. This will not only allow you as a user to have full system access but ANY rogue script (either downloaded manually or a script on a website) has full system access. This means you are effectively defenceless. You may get a little convenience from this but it means that anything you run has full reign over your system and you have no way to prevent it. It's stupid how people make so many guides for this crap and basically you are helping people to BREAK their system. The Ubuntu OS and the way sudo works is designed and implemented by groups of people who know a LOT more about Linux and Linux security, yet morons make posts like this to remove it.... makes no sense. Please stop making such idiotic "How to" guides. It's making effort for the community when people get stung and we have to bail them out.
Nov 20, 2015

- a rogue script does not need sudo to do damage (rm -Rf ~)
- a shell script can't be executed by a web browser
- having to type the same password many times during the day is a problem for me, and obviously for many other people. Sudo without password is especially useful on development machines.
- insulting people doesn't make you more convincing
Jérôme Jaglale
Nov 20, 2015
Just wanna say, iv'e been using this method for years on archlinux (single user box) and it has never resulted in a 'broken 'system'
Jan 18, 2016
Cool,Thank you.
Mar 25, 2016
Great thanks
May 28, 2016
How can I see my web mail password in Ubuntu?
May 10, 2017