LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-12-2009, 02:17 AM   #1
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Rep: Reputation: 51
How to disallow user to login as root?


I want to disallow root login on my RHEL Machine?
How can I make it possible?
 
Old 10-12-2009, 02:28 AM   #2
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by your_shadow03 View Post
I want to disallow root login on my RHEL Machine?
How can I make it possible?
Change root passwords and don't tell the user the new password. This is the usual way to accomplish that objective.
 
Old 10-12-2009, 02:38 AM   #3
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Original Poster
Rep: Reputation: 51
Thats Funny Answer..
Jokes Apart..


I need answer from Linux Freakers..
I need to disallow user to login as root.

Any idea?

Last edited by your_shadow03; 10-12-2009 at 02:40 AM.
 
Old 10-12-2009, 02:58 AM   #4
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,330

Rep: Reputation: 227Reputation: 227Reputation: 227
why?
 
Old 10-12-2009, 02:59 AM   #5
jmc1987
Member
 
Registered: Sep 2009
Location: Oklahoma
Distribution: Debian, CentOS, windows 7/10
Posts: 877

Rep: Reputation: 113Reputation: 113
Quote:
Originally Posted by your_shadow03 View Post
Thats Funny Answer..
Jokes Apart..


I need answer from Linux Freakers..
I need to disallow user to login as root.

Any idea?
Like do you mean stop the users from using the

Code:
$ su
(enter root password on prompt)'
Or are you trying to set it up where a user can access to certain root areas? You can use sudo for that.

Or if the users keep going into root with su command and you don't want them to have no root level access at out. Simply change root password and keep it a secret.

Other than that you need to post more information of what you really want because I don't think any body is going to understand "I need answers from Linux Freakers.."

Last edited by jmc1987; 10-12-2009 at 03:01 AM.
 
Old 10-12-2009, 03:03 AM   #6
~sHyLoCk~
Senior Member
 
Registered: Jul 2008
Location: /dev/null
Posts: 1,173
Blog Entries: 12

Rep: Reputation: 129Reputation: 129
Quote:
Originally Posted by your_shadow03 View Post
I want to disallow root login on my RHEL Machine?
How can I make it possible?
Try this.
 
Old 10-12-2009, 03:12 AM   #7
avijitp
Member
 
Registered: May 2005
Location: India
Distribution: FC11, Debian/Ubuntu, RHEL, Solaris, AIX, HP-UX
Posts: 161

Rep: Reputation: 32
In the /etc/ssh/sshd_conf set
Code:
PermitRootLogin No
Refresh sshd to re-read this new configuration. This will stop direct root login to the box. You need to login as regular user and then then su to root.
 
Old 10-12-2009, 04:32 AM   #8
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,234

Rep: Reputation: 138Reputation: 138
There is one part of the question there is no information on, are you trying to disable root logins completely, from SSH or at console? And this can only be to direct root logins, someone has to have an account that can sudo or something else you are locking yourself out and in the end at console an experienced enough user could easily by pass most possible ways of disabling root.
 
Old 10-12-2009, 05:48 AM   #9
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Original Poster
Rep: Reputation: 51
Sorry Guys if the question went little short.
I was looking for something which avijitp jotted.
One thing to ask you all:

Say i put PermitRootLogin No in sshd_config.
and user logged in through su.
Now he can run root-leel commands?
Why it is considered safe?
Doesnt all root commands run thru that?
 
Old 10-12-2009, 05:53 AM   #10
avijitp
Member
 
Registered: May 2005
Location: India
Distribution: FC11, Debian/Ubuntu, RHEL, Solaris, AIX, HP-UX
Posts: 161

Rep: Reputation: 32
Quote:
Say i put PermitRootLogin No in sshd_config.
and user logged in through su.
Now he can run root-leel commands?
Why it is considered safe?
Doesnt all root commands run thru that?
A user can become root with the help of su only if he knows the root password unless you decide to configure sudo to allow the users to gain root privileges without password.

So it effectively allows A user to run root level commands only if he knows the root password. Disabling direct root ssh login is often considered to be a good practice to protect the system from Bruteforce attacked which can exploit a week root password.

Hope this helps.
 
Old 10-12-2009, 05:56 AM   #11
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Original Poster
Rep: Reputation: 51
Thats mean if I login through su as root(I have root credentials !!!) so I can run any number of commands which a root uses Right?
 
Old 10-12-2009, 05:59 AM   #12
avijitp
Member
 
Registered: May 2005
Location: India
Distribution: FC11, Debian/Ubuntu, RHEL, Solaris, AIX, HP-UX
Posts: 161

Rep: Reputation: 32
Right!
 
Old 10-12-2009, 06:06 AM   #13
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Original Poster
Rep: Reputation: 51
My Next Question:
Can I completely disable root access?
 
Old 10-12-2009, 06:16 AM   #14
avijitp
Member
 
Registered: May 2005
Location: India
Distribution: FC11, Debian/Ubuntu, RHEL, Solaris, AIX, HP-UX
Posts: 161

Rep: Reputation: 32
Quote:
My Next Question:
Can I completely disable root access?
Why on the earth would you do that? You plan to install a system and plan not to maintain that? Someone responsible should have a super user (root) privileges.
 
Old 10-12-2009, 06:23 AM   #15
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
Originally Posted by your_shadow03 View Post
Thats Funny Answer..
Jokes Apart..


I need answer from Linux Freakers..
I need to disallow user to login as root.

Any idea?
That's not a joke, that is serious and it's true. If you're stupid enough to give tha password away, you can not prevent it by normal means.

Quote:
Originally Posted by your_shadow03 View Post
My Next Question:
Can I completely disable root access?
yes, check the -l (lowercase L) option of the passwd command

But I don't advise it for the root user as it is PERMANENT. You need root privileges to reverse it but can't gain those privileges as the account is locked.

The question that you have not answered yet is why you want this?
 
  


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
Adding root privaliges to user accounts or auto login as root Val-Ent Linux - General 15 03-02-2010 04:27 PM
Gnome: Cannot login as default user, sends back to login, works as root Danny-T Linux - Newbie 2 05-27-2006 03:44 AM
How do I disallow ssh login by root? Seventh Linux - Newbie 1 03-26-2005 10:30 AM
disallow ssh root login only from internet wensveen Linux - Security 10 03-21-2005 07:34 AM
telnet: DISallow root access MacDschie Linux - Software 2 05-14-2003 12:43 PM


All times are GMT -5. The time now is 05:22 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