When adding an existing user to a group, be careful of using ‘usermod.’ If done incorrectly, you can remove a user from its existing groups. In my case, I used ‘usermod’ to add myself to the www-data group. Since I did it wrong, I lost ‘sudo’ access on the next reboot. I ended up booting up from a rescue CD and restoring /etc/groups. Thankfully, Ubuntu keeps a backup copy called /etc/groups-.
sudo usermod -G www-data username
sudo usermod -a -G www-data username
So the only user I have in Ubuntu is no longer part of the sudoers group. How that happen? I have no access to root, and I don’t have admin access. Great. Very weird indeed. A bug?
Crontab is great when you want to run a program or a script at certain times of the day, week or month. You just schedule crontab, and it will run for you automatically, almost all the time, without a hitch. Crontabs are great if you have certain requirements that you want to run at specific times of the day. Now, each system user has their own individual crontab.
To run Crontab as a yourself, you simply type in the Terminal.
The crontab format is typically: * * * * * /var/www/yourscript.sh
But, I’m not going to go into details about crontab in this post.
If you need to run Crontab as another user, simply use the -u switch.
If a user doesn’t have permission to run crontab, you may need to run it as sudo.
sudo crontab -u username -e
I’ve learned something new today, Sudo. Sudo is a Unix command that allows system administrators to give certain users the ability to run some or all commands as root. Why? Well, I have this program called Bluefish which I use as a HTML editor. I have to run Bluefish as root to modify my webroot directory. I could have ran Bluefish as a regular user, but I didn’t want to use my home directory to shuttle back and forth the modified web pages.
Continue reading “Sudo”