If you have used your fresh Ubuntu install for longer than half an hour, chances are that you've discovered the sudo command already.
sudo allows certain users to execute a command under another user's privileges. Most commonly, using sudo implies running a command as a superuser, but the approach works equally well for allowing you to inherit a user ID (uid) and group ID (gid) of any user on the system.
To gain access, a password is asked, and by default it is your password, and not the password of a user you're trying to run a command as. This allows for the system' s administrator to effectively manage user privileges without having any user share their password.
sudo is based off the /etc/sudoers file, which should be edited by root employing the visudo command. WARNING: although /etc/sudoers file is a regular text which root can edit manually, ONLY visudo way of updating it is recommended, as this command, apart from editing capabilities, also does a syntax check of the changes before applying them to prevent user privilege related disasters.
If you want to grant superuser privileges to a particular user, the following line should be added to the /etc/sudoers file (just type visudo to invoke the editor):
greys ALL=(ALL) ALL
In this example, greys is the username.
Related books
If you want to learn more, here's a great book: