I changed the default username using usermod. and now whenever I type a sudo command it requires a password. I do it only when it is the first time I type sudo. further it does not require any password. I do not understand it.
closed as unclear what you're asking by joan, Milliways, Dmitry Grigoryev, Jacobm001♦ May 4 '17 at 17:25
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
This has nothing to do with changing the user name, it's default
sudo caches your credentials so you don't get asked if you do another
sudo within a short range of time (15 minutes is default). If you don't enter another
sudo command for 15 minutes, you'll get prompted again. Or do
sudo -k to reset the credentials immediately.
fixed with visudo line pi ALL=(All) NOPASSWD:ALL change : pi --> nex $USER thanks