LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to be a root in ubuntu? (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-be-a-root-in-ubuntu-826857/)

turf 08-17-2010 04:30 PM

how to be a root in ubuntu?
 
how to be a root in ubuntu?

i wanted to edit a text file in a folder and i can't since i'm not the root so i need to know how to be a root. but how?

snowpine 08-17-2010 04:33 PM

Use the "sudo" command:

Code:

sudo nano /name/of/file
When prompted for a password, enter your regular user password.

If you prefer a GUI text editor, use "gksu" (or "kdesu" if you're using Kubuntu)

Code:

gksu gedit /name/of/file
Lots more details here: https://wiki.ubuntu.com/RootSudo

Well worth reading this page, as Ubuntu's security model is a little different than many other distributions.

turf 08-17-2010 04:35 PM

so i don't need to login as a root?

thanks

snowpine 08-17-2010 04:37 PM

Quote:

Originally Posted by turf (Post 4069464)
so i don't need to login as a root?

thanks

You can if you want, but I can't think of a single instance it is necessary. ps You're welcome! :)

turf 08-17-2010 04:45 PM

how bout this..
Quote:

turf@turf-ubuntu:/$ cd root/
bash: cd: root/: Permission denied
how can i get into the /root?

r3sistance 08-17-2010 04:46 PM

Single user mode or any maintenance mode similar to that, and generally doing maintenance... you can do "sudo passwd root" to set the root password, in Ubuntu the root password is made of an unusable password by default what means root can not be logged in as. The only real advantage of sudo in my opinion is that it's usually a time limited idle before it dis-activates and thus needs the password. it's harder for people to break in while you have left the computer... but why would you be leaving the computer unlocked anyway if you were leaving it where other people could get to it? else wise putting sudo infront of something can become so common a lot of people would do the same mistakes with or without sudo anyway... as generally logging in as root as a main user is just ill-advised anyways... and why I prefer "su -".

blue_print 08-17-2010 04:51 PM

Turf, If you want to enter into /root directory, you will need to login as root user. Try to change the user to root suing sudo command.

sudo su

Then enter the password of the user turf.

snowpine 08-17-2010 04:52 PM

Quote:

Originally Posted by turf (Post 4069474)
how bout this..

cd root/

how can i get into the /root?

Unless you have a folder called "root" in your turf-ubuntu folder, try:

Code:

cd /root
It is not a permissions problem as a couple of other posters above seem to think (the 'cd' command does not require root privileges!) but rather bad command line syntax (the / character is in the wrong place). :)

Please take a minute to read through the document I linked to in post #2, it should answer many of your questions. You might also want to brush up on some command line basics before you go issuing commands with sudo, here is a good tutorial: http://www.tuxfiles.org/linuxhelp/cli.html

dixiedancer 08-17-2010 04:53 PM

This is "cheating" I guess, because it's just too easy! But I installed an awesome, ultralight file manager using Synaptic, called PCManFM (one of the jewels of the LXDE project). I use that to navigate to the folder that has the stuff I want to change, and then click on Tools > Open Current Folder as Root. Enter your computer's root password when prompted. Bingo! A new window opens up with a little caption that says, "Warning! You are now in Super User Mode!"

Click on whatever file you want to edit, modify, delete, move, whatever. When you close that Super User window, you're back to "ordinary user" but all your changes are saved. Sweet, huh?

Simple enough for even a silly little dixiedancer to do, lol.

-Robin

turf 08-17-2010 05:15 PM

finally got in by providing a root password this time. i'd like it that way where users need to give the root password. :D

but after getting into the grub,i seem can't see my menu.lst.
where the hell are they hiding these things, it seems complicated unlike most distros.where its easy to spot the lilo.conf or the menu.lst

r3sistance 08-17-2010 05:23 PM

menu.lst is from grub 1, grub 2 uses grub.cfg and I know Ubuntu (since 9.10) uses grub 2, however I am not certain of the changes you should be making with the grub 2 boot loader so if you could say what you are trying to do, perhaps other users could help you out with that?

snowpine 08-17-2010 05:28 PM

Quote:

Originally Posted by turf (Post 4069498)
finally got in by providing a root password this time. i'd like it that way where users need to give the root password. :D

but after getting into the grub,i seem can't see my menu.lst.
where the hell are they hiding these things, it seems complicated unlike most distros.where its easy to spot the lilo.conf or the menu.lst

Turf, you seem very confused. ;) Please read the Ubuntu documentation I linked to in post #2, it will explain why you don't need to enable a root password. You can of course do so if you choose (it's your computer) but it means you won't be able to follow the official Ubuntu documentation or use their support forums, both of which assume the use of 'sudo'.

Speaking of the Ubuntu documentation, it is excellent, and they have an entire chapter on GRUB (hint: there is no "menu.lst"): https://wiki.ubuntu.com/Grub2

I know it is tricky when a lot of different people on the internet are shouting conflicting advice at you. When in doubt, I encourage you to look for answers from sites with ubuntu.com in the URL. This will ensure you are getting accurate and up-to-date information. I hope I'm not coming off as a know-it-all... I certainly don't know all the answers! I just know where to look. ;)

turf 08-17-2010 09:23 PM

the link really help thanks a lot.

i got my 2nd OS working after creating a bashscript for the OS entry in etc/grub.d/
then i run update-grub

seems working now. thanks

sag47 08-17-2010 10:55 PM

If the sudo command annoys you you could emulate the root login in one of two ways... I can't remember the second but I use the following all the time because 1) I like and use bash to it's easy to remember and 2) when I switch to root user with this method it uses my users .bash_aliases and .vimrc file so I have all of my aliases and settings I want.

Code:

sudo bash

Kenny_Strawn 08-18-2010 12:02 AM

Quote:

Originally Posted by sag47 (Post 4069717)
Code:

sudo bash

Or even better:

Code:

sudo passwd
Then just enter your new root password and you'll be able to log in as root as much as you want...


All times are GMT -5. The time now is 01:46 AM.