In many cases, if you are writing shell scripts to do certain tasks, you might need to grant access to the user to some commands without requiring interaction. In that case you might want to grant access without requiring password. This is possible with sudo.
Go to command alias section and add the commands
Cmnd_Alias SCRIPTCMD = /bin/mkdir, /bin/chown
Now go to the end of the file and add :
username ALL = NOPASSWD: SCRIPTCMD
Also if the command is to be executed from webpage then you might want to disable the requiretty for that user as mentioned in my other post and also you might want to execute the command as :
sudo -tt /bin/mkdir
Also this works:
username ALL=(ALL) NOPASSWD: /path/to/binary or shell script
Disable TTY Requirement for sudo :
You can disable the Sudoers Default Require TTY on a per user level.