Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
12-31-2007, 11:35 PM
|
#1
|
Member
Registered: Aug 2004
Location: Philadelphia,PA
Posts: 185
Rep:
|
Disable root login via SSH not working
I added
PermitRootLogin no
to my /etc/ssh/sshd_config file and I can still log in via root without issues. I restarted services and even rebooted.
Anyone have any help for me?
|
|
|
01-01-2008, 12:25 AM
|
#2
|
LQ 5k Club
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842
Rep:
|
ssh daemon searches include /root and /home/name so if you have them....disable them with root powers.
And I assume you editted your /etc/ file with root powers?
|
|
|
01-01-2008, 01:49 AM
|
#3
|
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Rep:
|
Quote:
Originally Posted by vonedaddy
... I can still log in via root without issues.
|
Explain what you mean by that exactly.
|
|
|
01-01-2008, 07:30 AM
|
#4
|
Member
Registered: Aug 2004
Location: Philadelphia,PA
Posts: 185
Original Poster
Rep:
|
Quote:
Originally Posted by aus9
ssh daemon searches include /root and /home/name so if you have them....disable them with root powers.
And I assume you editted your /etc/ file with root powers?
|
Yes I edited the /etc/ file while logged in as root.
I am not sure what you mean by disable /root and /home/name with root powers, can you go into a bit more detail for me?
aus9:
I can still directly ssh into my box using the root credentials. I want to disable direct root logins for security purposes. I would like to only be able to log in via a user the be able to su - or sudo if needed.
|
|
|
01-01-2008, 08:23 AM
|
#5
|
LQ Newbie
Registered: Mar 2007
Location: Newcastle upon Tyne, UK
Distribution: Trustix, Fedora, Ubuntu
Posts: 16
Rep:
|
Quote:
Originally Posted by vonedaddy
I added
PermitRootLogin no
|
You say you added this; did you remove any lines that contradicted it? Check for other PermitRootLogin lines.
|
|
|
01-01-2008, 08:54 AM
|
#6
|
Member
Registered: Aug 2004
Location: Philadelphia,PA
Posts: 185
Original Poster
Rep:
|
Quote:
Originally Posted by Brianetta
You say you added this; did you remove any lines that contradicted it? Check for other PermitRootLogin lines.
|
I checked and there are none. Any other ideas?
|
|
|
01-01-2008, 10:40 AM
|
#7
|
LQ Newbie
Registered: Nov 2003
Location: USA
Distribution: Debian and Slackware
Posts: 17
Rep:
|
Disabling root login via SSh
As root, edit the file /etc/sshd_config. Add a line that says:
AllowUsers yourusername
Make sure there is no line that says:
AllowUsers root
Hope this helps! :-)
|
|
|
01-01-2008, 10:50 AM
|
#8
|
Member
Registered: Aug 2004
Location: Philadelphia,PA
Posts: 185
Original Poster
Rep:
|
Quote:
Originally Posted by sys-fire
As root, edit the file /etc/sshd_config. Add a line that says:
AllowUsers yourusername
Make sure there is no line that says:
AllowUsers root
Hope this helps! :-)
|
No it did nothing... Just to let you know this happened after following the chrootjail instructions here:
http://adamsworld.name/chrootjail.php
|
|
|
01-01-2008, 11:25 AM
|
#9
|
LQ Newbie
Registered: Nov 2003
Location: USA
Distribution: Debian and Slackware
Posts: 17
Rep:
|
Did you restart ssh with /etc/init.d/ssh restart?
|
|
|
01-01-2008, 11:35 AM
|
#10
|
Member
Registered: Aug 2004
Location: Philadelphia,PA
Posts: 185
Original Poster
Rep:
|
Quote:
Originally Posted by sys-fire
Did you restart ssh with /etc/init.d/ssh restart?
|
Not exactly, there is not such file
[root@bighat ~]# /etc/init.d/ssh restart
-bash: /etc/init.d/ssh: No such file or directory
[root@bighat ~]# /etc/init.d/sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
[root@bighat ~]#
I dont know if there is a different between ssh and sshd
And I can still log in via ssh with root credentials.
Last edited by vonedaddy; 01-01-2008 at 11:37 AM.
|
|
|
01-01-2008, 01:55 PM
|
#11
|
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Rep:
|
Quote:
Originally Posted by vonedaddy
|
This is probably an important clue as to why the problem is occurring.
Note that only the PermitRootLogin no directive is required to prevent ssh root@some.host from working. The additional AllowUsers directive is fine, but it is not necessary since there is already a directive that should do exactly what you want.
It's likely that your sshd daemon inside the chrooted environment is not properly reading its /etc/ssh/sshd_config file. (In fact, I question that howto; I don't see that he is moving any sshd_config file into the chrooted environment.)
My short answer is: Don't bother chrooting the sshd daemon. It's a subpar 'security' feature. A better alternative is to put sshd in a Linux-VServer if you want to contain users.
|
|
|
01-03-2008, 09:18 PM
|
#12
|
LQ Newbie
Registered: Nov 2007
Distribution: centOS
Posts: 16
Rep:
|
You do not need to move the sshd_config file into the chrooted environment. The user does not need access to this file or any other binaries or config files.
Because this only allows for SFTP, they do not need access to such things.
The user will see the dir structure as something like this(will vary depending on what you let them do with it)
Code:
/public_html
/private
/logs
Thats it. They don't need anything else.
Also the original problem here is that the tutorial doesnt use the 'stock' install version of openssh. It installs into the /opt directory and therefore all paths would now be relative to that.
If you notice anything blatantly wrong please let me know as I am not an expert, its just that there wasn't enough information about how to do this easily so I copied my working procedure (and tested it).
-Adam
|
|
|
All times are GMT -5. The time now is 12:28 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|