1

I have had Ubuntu for a few months by now, and I have set up an administrator profile and a 'normal' account, which I use for everyday work.

Sometimes I need the admin profile, e.g. to install programs. This means that I have to switch profiles, execute whatever commands I need with sudo through the admin profile and then go back to work.

This is rather uncomfortable, as sometimes I have got open web pages with the instructions of what I have to do on my work profile.

Is there a way to use sudo with admin username/password while I am still logged in as 'work'?

Are there any other alternatives?

1
  • Note that you can easily switch user sessions via Ctrl+Alt+Fn where n >= 7.
    – ignis
    Oct 30 '13 at 14:26
2

The most convenient way is to use the terminal where you can launch programs with admin privileges. There are 2 options:

  1. You can add your normal user to the group of sudoers:

    sudo adduser normal-username sudo
    

    See Can I have a user execute sudo commands without being an administrator?

    Now you can execute commands in the terminal by writing sudo command

  2. Use your admin profile:
    To use your admin profile in the terminal, you can su to that user, like su admin-username and then enter the admin user's password. If this doesn't work for the programs you want to run (it won't work for graphical applications), see this question:

    How can I run an application with a GUI as admin from a non-admin user session?

2
  • Hey, that's great! Thanks, it's just what I was looking for: open terminal --> su <admin> --> insert password --> do what you need to do! Have a nice day, Max
    – user209562
    Oct 30 '13 at 15:36
  • Adding a user to the sudoers group makes him theoretically already an admin user... :-/ That is probably not intended.
    – Byte Commander
    Aug 6 '15 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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