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. |
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.
|
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) 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 |
Quote:
Code:
su [-] <user> -c "command1; command2; command3; .... " That way you can't forget to type exit ;} Cheers, Tink |
All times are GMT -5. The time now is 10:57 PM. |