LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-22-2006, 01:57 AM   #1
MrSako
Member
 
Registered: May 2006
Distribution: CentOS 4.4
Posts: 185

Rep: Reputation: 30
logging into the root in terminal


i have centos 4.3 with gnome graphical desktop. i have a root login and a user login. id normally work as a user and use root to do things like install applications. the thing is i cant just keep logging out and into root to install something with yum or something and then go back.

what i would like ot do is be able to log into root in the terminal and have root privledges until i logout of root in the terminal. or something very much like this.
 
Old 06-22-2006, 02:05 AM   #2
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 271Reputation: 271Reputation: 271
This is what the su command or sudo command is for. man su or man sudo. su lets you become root (you should use gksu to run gui apps as root) and sudo lets you do things as a user with root priveledges.
 
Old 06-22-2006, 03:57 AM   #3
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
As pljvaldez suggests, su and sudo are your friends.

su or "switch user" let's you use another user's account without having to logout/login.
Type "exit" to go back to your original (login) user.
Examples:
Code:
su   #switches to root user (providing you have password)
su - #also switches to root user, but also loads root's environment settings (like $PATH)
su some_user #switches to user "some_user" (again, you'll need that user's password)
sudo needs to be configured by root and allows certain users, to execute certain commands as if they were root.
They won't need root's password for this. root should set up the /etc/sudoers file. Needless to say, making normal users run programs as root, can create security hazards. So use it with care.
You won't need to "exit" after sudo'ing, because sudo only let's you execute just one command.
Example:
Code:
sudo some_command #will execute "some_command" as root, if /etc/sudoers file allows it
 
Old 06-22-2006, 04:14 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by timmeke
As pljvaldez suggests, su and sudo are your friends.

su or "switch user" let's you use another user's account without having to logout/login.
Type "exit" to go back to your original (login) user.
Examples:
Code:
su   #switches to root user (providing you have password)
su - #also switches to root user, but also loads root's environment settings (like $PATH)
su some_user #switches to user "some_user" (again, you'll need that user's password)
And
Code:
su [-] <user> -c "command1; command2; command3; .... "
(The syntax depends on your version of su, it may vary, check the man-page)
lets you execute commands as the other user without requiring a shell.
That way you can't forget to type exit ;}


Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Logging on as root from The Terminal bobbasic2002 Linux - General 3 03-16-2014 07:44 PM
Logging into another terminal gianh Linux - Newbie 4 04-22-2006 04:39 PM
Problem in text based terminal when logging as root MSafty SUSE / openSUSE 3 08-22-2005 04:14 PM
Problem in text based terminal when logging as root MSafty Linux - Software 2 08-17-2005 12:09 AM
using red-carpet without logging out and logging as root. packman Linux - Software 1 12-09-2002 03:55 AM


All times are GMT -5. The time now is 01:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration