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 downloaded a .run file for a Nvidia driver, but when I run it in the terminal it tells me it must be run as root.

I'm a complete noob and I barely even know what root is. I think it's somewhere around the equivalent of admin in windows. driver run as root

Well, I got the file to run but it turns out that the driver will not recognize my card. I've heard about other problems with Nvidia cards not working right with 64 bit versions of 12.04.

share|improve this question
3  
If you are, as you say, a complete noob, perhaps there is a better and easier way to do what you're doing. Are you simply trying to install the Nvidia driver? There is a point and click interface for that - look for "Additional drivers" under your system settings. If you have already tried that, could you let us know, and what went wrong? –  neon_overload May 31 '12 at 6:10
1  
In case your are not so experienced with Ubuntu I would go a step further and like to discourage you from installing graphic drivers other than through the methods mentioned above. –  Takkat May 31 '12 at 9:44
    
Also if you want to test a beta driver, look at this askubuntu.com/questions/131150/… –  desgua May 31 '12 at 11:14
1  
There are no drivers under the "additional drivers" setting. I don't need to be discouraged, how else will I learn but through trial and error? Beta driver? I will look into that. I have plenty of time to re-install ubuntu thousands of times. –  Daniel Richardson May 31 '12 at 19:47
    
@neon_overload, I know this is an old thread, but I would just like to point out that I had to install "Additional drivers" from the Ubuntu Software Center, as it didn't show up by default –  Sosi Apr 10 '13 at 17:55

3 Answers 3

up vote 3 down vote accepted

You need to do two things; both from a Terminal prompt:

1. Change to the directory where you have the '.run' file stored.
2. Type: chmod 755 filename.run
3. Type: sudo ./filename.run

The above commands will make the file executable and will launch the executable with root-level permissions.

share|improve this answer
    
But the file ran OK, obviously, so why confuse him with unnecessary steps? Also, you should specify that "filename" is not to be typed literally, but substitutes for the name of the .run file. –  Marty Fried May 31 '12 at 4:19
    
It's alright, I understood it. I had to google some things but in the end it was fine. –  Daniel Richardson May 31 '12 at 5:04

root is the master account in Ubuntu; every account has limited privileges but the root account has no limitations. The reason for hiding root is that in most cases you don't need root access. The analog in Windows would be having to authenticate when you want to install a driver; in Ubuntu you have to be root or have root privileges.

There are two ways for you to get access as root. You can type:

sudo <whatever-command> and Ubuntu will ask you for your password and then execute that command as root.

OR

sudo su, where you'll input your own password and then you will become root (i.e. you will be logged in as root).

I prefer the latter because it gives me more control; sometimes running a command just as root isn't enough, but doing it this way can be more dangerous (i.e. you could accidentally cause more damage).

I recommend trying the first way. And then trying the second way if that doesn't work. Just make sure you get out of root after you're done (i.e. type exit after you're finished doing what you need to do as root).

share|improve this answer
    
sudo -s is widely considered preferable to sudo su (though this may have more to do with elegance than anything else). To get a root shell that behaves like an actual root login, use sudo -i instead. (This is similar to sudo su -.) Also, logout will not work to get out of a sudo su shell, because such a shell is not a login shell. You need to use exit instead. –  Eliah Kagan May 31 '12 at 7:36
    
@EliahKagan Cool! I didn't know about sudo -i/-s. Good point on exit, I mistyped that. I'll edit the entry above. Can you explain why sudo -s is more "elegant"? –  Avery Chan May 31 '12 at 22:56
    
Sure, but first some background so that the explanation can be beneficial to others. su and sudo are two separate mechanisms for running a command as a some user, who may be different from the user invoking them. (If not otherwise specified, su and sudo will run--or attempt to run--the command as root.) Since su authenticates with the target user's password, and password authentication for root is turned off by default (and not recommended or officially supported) in Ubuntu, you cannot use su to become root, but root can certainly use su to become some other user. –  Eliah Kagan May 31 '12 at 23:15
    
sudo and su are both capable of running a single command. sudo does this by default and su does this when given the -c flag. They are also both capable of starting a shell. sudo does this when given the -s flag (or -i to simulate an initial login shell), and su does this by default (or when given the - flag, to simulate such a login shell). When you run sudo su, you are becoming root with sudo, and then becoming root again as root (i.e., root su-ing to itself), to start a shell. It's more elegant to just "change" identity once and start the login shell... –  Eliah Kagan May 31 '12 at 23:20
    
...which is what sudo -s (or sudo -i) accomplishes. su -c 'sudo ...' (with ... replaced by a command) would be similarly inelegant. Commands like sudo bash are considered a bit inelegant for a different, related reason--sudo has the -s and -i flags to start a shell however you like, so one may as well use them. While these ways are inelegant (and subtly different in their effects from the suggested sudo -s and sudo -i), they are not actually bad and they work fine, so it's OK to go on using them if you wish. –  Eliah Kagan May 31 '12 at 23:23

Add the command "sudo" before the command. For example: sudo blah.sh

After you enter your password the command will run as root. Be careful to verify the trustworthiness of a package or command before running it with sudo.

share|improve this answer
    
PS you really should read help.ubuntu.com/community/RootSudo –  notkevin May 31 '12 at 4:01
    
Of course, if the command is ./blah.sh then to run it as root you would do sudo ./blah.sh, rather than sudo blah.sh (which would only run blah.sh if it's in the $PATH). –  Eliah Kagan May 31 '12 at 7:38
    
Attention, must possibly use gksudo for graphicals... –  MUY Belgium Nov 26 '13 at 21:01

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.