2

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?

2 Answers 2

2

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

2
  • Thanks. My username on this computer is simply familyadmin. Do I type in "su - familyadmin" ?
    – Mikelane
    Mar 21, 2013 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. Mar 21, 2013 at 11:13
1

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

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .