Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 07-15-2006, 08:36 PM   #1
Registered: Aug 2005
Distribution: slackware!
Posts: 43

Rep: Reputation: 15
Disable root login [solved]

How do you disable root's ability to login to slackware? Like in ubuntu. I find myself forgetting I'm root and doing bad things all the time, and it would be easier just to force myself to use sudo.

Last edited by n00bified; 07-15-2006 at 08:44 PM.
Old 07-15-2006, 08:41 PM   #2
Registered: Jul 2001
Distribution: Slackware 12
Posts: 511

Rep: Reputation: 32
I suppose if you really wanted to do that, you could do:

chsh -s /bin/false root
Old 07-15-2006, 08:44 PM   #3
Registered: Aug 2005
Distribution: slackware!
Posts: 43

Original Poster
Rep: Reputation: 15
Thanks for the quick response.
Old 07-15-2006, 08:50 PM   #4
Registered: Jan 2006
Location: Bakersfield, California
Distribution: CentOS 5.3, FreeBSD 7.2, Fedora 11
Posts: 83

Rep: Reputation: 15
You could always add

PermitRootLogin no

to /etc/ssh/sshd_config and disable root's ability to login via ssh. It's a security plus and it makes you use 'su'. However root can still login on the box itself.

I'd think changing root's shell would break a lot of things though?
Old 07-15-2006, 08:54 PM   #5
Registered: Jul 2001
Distribution: Slackware 12
Posts: 511

Rep: Reputation: 32
It does sound like it could break some stuff now that I think about it. That was just the first way I thought of.
Old 07-15-2006, 08:55 PM   #6
Registered: Aug 2005
Distribution: slackware!
Posts: 43

Original Poster
Rep: Reputation: 15
Yeah.. umm it does break things.. Just after five minutes I've noticed some issues, with package management mostly.

Thanks for your ssh tip, but I don't have SSHd starting automatically, this is a laptop.
Old 07-15-2006, 10:58 PM   #7
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
I think that how Ubuntu does it is to disable the root account. You can use the passwd command to do it. "sudo passwd -l root" to lock out root, and "sudo passwd -u root" to unlock it. The effect will be to add a "!" character in front of the /etc/shadow encrypted password field.

You will want to make sure that you can log into single mode, or using a rescue disk, in case this causes problems and you need to be root to change back. I tested this with a dummy user account but not with the root account while composing this post.

Also, edit your /etc/sudoers file using "visudo" to grant yourself permission to run root commands using sudo. Making yourself a member of the "wheel" group and uncommenting the line for %wheel in visudo is the way it usually is done. ( You probably have already done this. )

The sshd_config tip is a good one, and I would do it anyway, in case you decide to use it in the future and enable sshd temporarily. I would also recommend adding your user name to "AllowUsers" and uncommenting that entry. This way, a hacker would only be successful by guessing both your username and password.

Last edited by jschiwal; 07-15-2006 at 11:03 PM.
Old 07-17-2006, 04:03 AM   #8
Senior Member
Registered: Mar 2006
Distribution: SLACKWARE 4TW! =D
Posts: 1,519

Rep: Reputation: 62
I could be wrong, but doesnt the 'sudo' in Ubuntu time out after 15 minutes or so.

So in theory if he get's rid of root, the does sudo once, wouldnt every thing he does for now on be as root and effectively get himself into trouble?
Old 07-17-2006, 05:42 AM   #9
LQ Newbie
Registered: Jun 2005
Location: Queen City of the South, Cebu City
Distribution: slackware-current
Posts: 12

Rep: Reputation: 0
i have tried like giving a certain user that can do the command su but unfortunately i forgot how i did it. is there someone who can refresh my memories? thanks.


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
Disable Root login via ssh UltraSoul Solaris / OpenSolaris 3 02-09-2007 03:18 AM
vsftpd - how do I disable root login? hunterhunter Linux - General 5 03-27-2006 05:55 PM
disable root login with ssh linuxtesting2 Slackware 3 02-16-2005 01:33 PM
how to make root login disable vijaysh Linux - Security 2 02-08-2005 01:48 PM
How can I disable root login with SSH? blk96gt Slackware 9 10-02-2004 08:09 AM > Forums > Linux Forums > Linux - Distributions > Slackware

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

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