I have a correctly working Debian server. All existing users who have been granted
sudo rights can utilize
sudo without any problems. However, a new user with a username that has a dot in it sees "Username is not in the sudoers file. This incident will be reported" when attempting to
I don't see any steps that were missed for this user. Here are my steps:
Create a privileged user with a dot in the username. I use this little script to add developer user accounts.
#!/bin/bash uu=$1 useradd -m -G sudo,webdev -s /bin/bash $uu passwd $uu cd /home/$uu/ mkdir .ssh/ touch .ssh/authorized_keys chmod 600 .ssh/authorized_keys chmod 700 .ssh/ chown -R $uu:$uu .ssh/ ls -la .ssh/ cat $uu.pub > /home/$uu/.ssh/authorized_keys echo "finished"
Check that user is in the sudo group:
getent group sudo
This already exists in
# Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL
Next I made /etc/sudoers.d/user.name (and set permissions to 640):
nano /etc/sudoers.d/user.name user.name ALL=(ALL) NOPASSWD: ALL
To test, log in with the user account and try to
sudo. I get the above error.
One way I was able to resolve this was by adding this user to a different group that has sudo rights.
Either I am missing something, or the dot in the username is causing a problem that is not experienced with the other usernames.