Setup sudo by issuing in a terminal as root "vigr" first and add your
normal user to the wheel group. It should look like this:
Code:
wheel:x:10:root,stuart
Then setup sudo by issuing "visudo" and uncomment this line:
Code:
# %wheel ALL=(ALL) NOPASSWD: ALL
You will be using the editor vi, and might not be familiar with it. So
let me make it simple just to get you setup.
After you issue "vigr" press the I key or press Insert and move the cursor
to the end of the wheel group line. Then type a , then your username. Then
to close the vi editor, press Esc and then :wq (semi-colon then w then q)
which means write and quit. Then for the "visudo" you can simply move the
mouse cursor to the # in the front of that line and then press x which will
remove the # then :wq
After that is done, as a normal user you can enter "sudo -i" in a terminal
and you will su to root and his home directory with his environment variable.
From there you _are_ root, and issue commands as root.
And you can issue any command that is in your normal users $PATH just by adding
sudo in front of it as stated above. However, if the command is not in your
normal users $PATH, you will have to give the full path to the command. To see
what path a user has, as that user in a terminal type $PATH and press Enter.
For instance, you would need the full path to shutdown, i.e. "sudo /sbin/shutdown -h now"
After experimenting with things similar to what you posted, this seemed to me
to be the easiest way to set it up.