LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (http://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   Root Login (http://www.linuxquestions.org/questions/linux-enterprise-47/root-login-4175439294/)

sunveer 11-29-2012 04:57 AM

Root Login
 
Do Company persons login as root or a regular user? If they login as regular user, then how do they manage their operations which can only be performed by root.

I am doing root user operations using sudo but its very frustrating.

snowpine 11-29-2012 05:11 AM

Hi, can you explain the frustration of using 'sudo'? I'm not sure I understand the question; which tasks specifically you are having trouble accomplishing with 'sudo'? Also, which distribution are you using, and have you read your distro's documentation about sudo/root user?

sunveer 11-29-2012 05:55 AM

Quote:

Originally Posted by snowpine (Post 4839437)
Hi, can you explain the frustration of using 'sudo'? I'm not sure I understand the question; which tasks specifically you are having trouble accomplishing with 'sudo'? Also, which distribution are you using, and have you read your distro's documentation about sudo/root user?

Means I have habit of directly entering commands, and with sudo every command has to be prefixed with sudo. I am using RHEL.

steelneck 11-29-2012 06:00 AM

The only ones who login as root should be system admins, not regular users.

You have to give us examples of the "root-operations" you have in mind. Normally a regular user can use all programs on the system, with the exception of those installed under sbin and those programs are restricted for very good reasons. If you talk about accessing CDs, scanners and so on, this can usually be solved by having users with the right group permissions.

sunveer 11-29-2012 06:06 AM

Quote:

Originally Posted by steelneck (Post 4839460)
The only ones who login as root should be system admins, not regular users.

You have to give us examples of the "root-operations" you have in mind. Normally a regular user can use all programs on the system, with the exception of those installed under sbin and those programs are restricted for very good reasons. If you talk about accessing CDs, scanners and so on, this can usually be solved by having users with the right group permissions.

Like installing packages using yum or configuring any services.

snowpine 11-29-2012 06:09 AM

Quote:

Originally Posted by sunveer (Post 4839456)
Means I have habit of directly entering commands, and with sudo every command has to be prefixed with sudo. I am using RHEL.

Which is bad why? You really aren't giving enough details to help us answer your question. So far in this thread you have typed 417 characters, which is equivalent to typing 'sudo<space>' 83 times, in your quest to avoid 5 keystrokes.

Anyway if you know the root password you can get a root shell with:

Code:

su -
If you don't know the root password and your admin has asked you to use 'sudo' you'll have to discuss it with him/her.

druuna 11-29-2012 06:18 AM

As stated before by others: do not become root unless you really, really need to.

If typing 5 extra characters is a problem or you are prone to forget the sudo<space> part: Why don't you alias those commands?
Code:

alias xyx='sudo xyz'

sunveer 11-29-2012 06:19 AM

I am the admin and since it is advised to login as regular user instead of root user for security reasons, that's why I want to ask how can I manage my work while logged in as regular user. Or I have to login as root to perform the day to day work.

snowpine 11-29-2012 06:24 AM

Quote:

Originally Posted by sunveer (Post 4839473)
I am the admin and since it is advised to login as regular user instead of root user for security reasons, that's why I want to ask how can I manage my work while logged in as regular user. Or I have to login as root to perform the day to day work.

My recommendation is to log in as regular user for everyday tasks and use 'sudo' or 'su -' to perform only those tasks which require root priv's.

You haven't given any specific examples of which tasks are problematic, it is hard to discuss this in the abstract.

sunveer 11-29-2012 06:35 AM

Quote:

Originally Posted by snowpine (Post 4839479)
My recommendation is to log in as regular user for everyday tasks and use 'sudo' or 'su -' to perform only those tasks which require root priv's.

You haven't given any specific examples of which tasks are problematic, it is hard to discuss this in the abstract.

It is no hard but since its my first time using sudo so I forget to enter sudo every first time. But thanks to tell me that I am doing the things the right way.

Adickel 12-06-2012 08:29 PM

I work in an enterprise Linux environment, I have root access to all our Linux environments and regularly login as root, a lot of my work just can't be done as a regular user.

solarisguy 12-19-2012 03:39 AM

Quote:

Originally Posted by Adickel (Post 4844186)
I work in an enterprise Linux environment, I have root access to all our Linux environments and regularly login as root, a lot of my work just can't be done as a regular user.

Use "sudo su -" to become root. It leaves an audit trail for activities of your user account, yet allows you to operate without prepending "sudo" to every command.

TobiSGD 12-19-2012 07:24 AM

Quote:

Originally Posted by solarisguy (Post 4852650)
Use "sudo su -" to become root. It leaves an audit trail for activities of your user account, yet allows you to operate without prepending "sudo" to every command.

The correct way to get a root shell using sudo is
Code:

sudo -i

wstewart 12-20-2012 01:13 AM

Quote:

Originally Posted by TobiSGD (Post 4852807)
The correct way to get a root shell using sudo is
Code:

sudo -i

That's just one way of doing it unless you can think of a reason why one souldn't use "sudo su". It works just as well and is probably a little easier to type.

druuna 12-20-2012 01:45 AM

Quote:

Originally Posted by wstewart (Post 4853453)
That's just one way of doing it unless you can think of a reason why one souldn't use "sudo su". It works just as well and is probably a little easier to type.

No, it doesn't work the same/just as well.

sudo -i simulates a login shell and sets environment accordingly.
sudo su a partial environment is set (no .profile/.login is read).

Have a look at the sudo man page.


All times are GMT -5. The time now is 08:46 PM.