Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've set up an ubuntu computer for my sisters. There is the admin account which only I can access and there are two normal accounts.

Occasionally I'm going to be called upon to install an extra program, check a setting or fix a problem. Instead of logging out and then logging into the admin account, it would be much easier if I could fix the problem from the terminal when I am handed the computer.

For example, I wanted to check the iptables policies whilst logged into the normal account.

When I typed in sudo iptables -L -v

I was not able to access that command since the normal user account I was logged in did not have privileges, and it gave a message saying that the incident would be reported.

I logged back into the admin account, and added the user to the sudo group.

When testing the iptables command again when logged in as the normal account, it only requested the normal user's password. I do not want this. For security measures, I would prefer that only the root password be used to execute these commands, especially when logged into the normal user account.

How can I execute commands requiring root privileges whilst logged into a non-admin account, and ensuring that only the root password can be used to execute those commands?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

You can login to sudo account from terminal and then execute the sudo command. Basically, open up a terminal and do

su - sudousername

and then you can run sudo from terminal If you need to to exit just do

exit

share|improve this answer
    
Thanks. My username on this computer is simply familyadmin. Do I type in "su - familyadmin" ? –  Mikelane Mar 21 '13 at 9:32
    
Yes enter su - familyadmin you are now the administrator use sudo or gksu as required to make your changes then exit when finished. –  Warren Hill Mar 21 '13 at 11:13

You can use '-c' option in su for that.
Eg. su -c 'iptables -L -v' sudoer_username

Refer: http://manpages.ubuntu.com/manpages/precise/en/man1/su.1.html

share|improve this answer
    
Thanks, that worked also –  Mikelane Mar 21 '13 at 15:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.