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.
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.