2

While logged in as the root account of a CLI installation, almost every application gives me this error:

Don't run this as root!

I want to bypass this error and run the application while logged into root. How do I do this?

Edit: I understand the risks of using the root user and I will still want to use it. Thank you for your suggestions.

12
  • 3
    Why do you need to run applications as root?
    – Pilot6
    Jul 11, 2016 at 9:46
  • @Pilot6 The root account will be my main account on the system.
    – Dev
    Jul 11, 2016 at 9:52
  • Why the downvote? Am I doing something wrong?
    – Dev
    Jul 11, 2016 at 9:53
  • 1
    Read this: askubuntu.com/a/207481/163331
    – Parto
    Jul 11, 2016 at 9:55
  • 1
    "Edit: I understand the risks of using the root user." No, you don't. Use a system that uses root and not sudo by default. Picking Ubuntu implies using sudo.
    – Rinzwind
    Jul 13, 2016 at 6:59

4 Answers 4

3

You may add your very own User with sudo rights. You can create a User and add this User to the sudo Group.

sudo adduser youruser sudo

Or if you already have a user, you can add this to the sudo Group.

sudo usermod -a -G sudo youruser

After this log in to this user with su youruser and try to run the installation again with sudo yourinstallcommand.

You should never run any Installations with the root User. User always your very own User with sudo due to security reasons.

2
  • I re-worded my question so people may understand I am looking to run the application using the root account. Thanks for your help, but unfortunately I do not wish to use this method.
    – Dev
    Jul 11, 2016 at 9:56
  • You cant install the software with the root user. Just add your very own User with root privileges as described above. Jul 11, 2016 at 10:07
1

Fortunately this question has an answer that works. Using the root account is insecure and I understand that. The accepted answer there is going to help me a lot. Thank you for your suggestions, criticism, and help, bobbyblackblech, Pilot6, Serg, and Parto.

1

Ubuntu comes with sudo by default. sudo is a package/command that allows you to run any command/application as root (sudo stands for SuperUser Do).

Your user is by default in sudoers file if you are administrator (who installs the system, per example).

Simply type:

sudo <command>

Example:

sudo gedit

This runs gedit as root. BE EXTREMELY CAREFUL WITH SUDO AND SUPERUSER/ROOT.

3
  • I understand what sudo is. I have already found a solution.
    – Dev
    Jul 11, 2016 at 11:34
  • Then you must mark the question as answered. Jul 11, 2016 at 12:30
  • I cannot mark it for 2 days, @Juanjo
    – Dev
    Jul 11, 2016 at 12:32
0

In addition to sudo, you might also need to disable X access control within your user X session:

xhost +
sudo foo
...
sudo bar

For foo and bar being X applications.

But I agree with everybody: don't do that!

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