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.

Possible Duplicate:
How to know my root password?

I have been trying for a week and a half trying to become root so I can change the motd for an assignment and I have had no luck. Can someone break it down into linux for dummies style please. I have done every update for ubuntu 12.04 do not know if this why it is giving me a hard time? Thank you in advance for your help.

share|improve this question

marked as duplicate by Jorge Castro, jrg May 21 '12 at 20:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
I wouldn't say it's a duplicate. The linked post is a problem related to a 3rd party application not expecting Ubuntu's security policy, whereas this one seems to rather just be the user not understanding Ubuntu's security policy. Still a well documented problem(non-problem) but probably not a duplicate of that specific link in my opinion. –  adempewolff May 21 '12 at 18:54
    
Not a duplicate whatsoever –  Insperatus Oct 28 at 8:29

4 Answers 4

I would recommend trying it through command line.

First, open up terminal. Then enter this command sudo su and press enter. It will prompt for your password. After entering the password, everything that you are doing WITHIN THE TERMINAL is being done as you as root. I emphasized that to show that anything you do outside of the terminal will NOT be root.

So, to edit the motd, type this into terminal: gedit /etc/motd and edit your file accordingly.

share|improve this answer
2  
sudo -i works too instead of sudo su. That said, it is not a very good idea to be root in an interactive shell for small jobs like these. –  jippie May 21 '12 at 18:58

In order to use root privileges, you need to use sudo, and your user has to belong to the sudo group.

to find out if you're user is a member of the sudo group, you can just run the groups command:

nathwill@ragnarok:~$ groups
nathwill adm cdrom sudo dip plugdev lpadmin sambashare libvirtd

Then, to run a single command "as root", you just do sudo command arg

To assume root privileges indefinitely, or "sign in as root", you can use sudo -i to obtain a root prompt.

share|improve this answer

Ubuntu's security policy does not allow anyone to become root (see here and here).

Instead preface every command with sudo and then use your password to gain root privileges for that command.

SUDO Examples:

Copy a file to a directory owned by root:

sudo cp ~/example.txt /etc/example.txt

instead of

cp ~/example.txt /etc/example.txt

To change the privileges of a file owned by root:

sudo chmod 775 example.file

instead of

chmod 775 example.file

You don't actually ever need to become root; you can always use sudo to preface commands that require root privileges.

For applications that have a GUI, use gksudo.

GKSUDO Examples:

To edit a text file owned by root:

gksudo gedit example.txt

instead of

gedit example.txt

If your want to browse/copy/paste/etc. files using a GUI you can run

gksudo nautilus

instead of

nautilus

All of these commands can be entered into a terminal, or, if you'd prefer to not use a terminal, you can just press alt-F2 and enter the commands there.

Hope this helps!

share|improve this answer

You can turn your terminal into a root session by typing su or you can prefix a command with

sudo <command>

to run that particular command as a superuser/root

To edit motd, the command is

 sudo nano /etc/motd.tail

nano is a terminal text editor.

If you want to use a graphical interface just swap nano out for gedit.

share|improve this answer
1  
If you want to use gedit you should swap gksudo for sudo as well. ie. gksudo gedit /etc/motd.tail –  adempewolff May 21 '12 at 18:36

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