Bug 169678 - "PermitRootLogin no" fails to prevent scp logins
Summary: "PermitRootLogin no" fails to prevent scp logins
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: openssh
Version: 4.0
Hardware: x86_64
OS: Linux
Target Milestone: ---
: ---
Assignee: Tomas Mraz
QA Contact: Brian Brock
Keywords: Security
Depends On:
TreeView+ depends on / blocked
Reported: 2005-09-30 23:33 UTC by Colin Walters
Modified: 2007-11-30 22:07 UTC (History)
0 users

Clone Of:
Last Closed: 2005-10-04 11:16:58 UTC

Attachments (Terms of Use)

Description Colin Walters 2005-09-30 23:33:22 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.0.7-1.1.fc4 Firefox/1.0.7

Description of problem:

I did a stock RHEL4 AS install, and added "PermitRootLogin no" to the end of /etc/ssh/sshd_config.  As expected, "ssh root@hostname" was denied.  However, "scp  /path/to/file root@hostname" was still allowed!  

I had to add "DenyUsers root" as well to prevent scp from working.  

At best, "PermitRootLogin no" needs a massive warning around it.  The sshd_config man page doesn't say much about it, nor does the config file have any comment.
At worst, this is a security issue that I bet a number of admins have and don't know it...

Marking this bug as security priority for safety, if you disagree feel free to downgrade of course, but hopefully we'll get a warning somewhere.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Install openssh
2. Add PermitRootLogin no

Actual Results:  scp access was allowed

Expected Results:  scp access should be disallowed

Additional info:

Comment 1 Tomas Mraz 2005-10-04 11:16:58 UTC
"scp /path/to/file root@hostname" is roughly identical to
"cp /path/to/file root@hostname"

You forgot to put ':' after the hostname. The scp uses ssh to connect to the
remote machine so the "PermitRootLogin no" setting must apply to it too.

Comment 2 Colin Walters 2005-10-04 15:06:13 UTC
Hi, I do forget to add the colon suffix sometimes, but when that occurs, I
always immediately realize my mistake when I don't see the expected remote copy
progress output.

I didn't add the trailing : in my bug report because I wasn't pasting actual
commands, the quotes were misleading there.

I think what happened was that at some point during my testing sshd didn't
restart correctly and didn't pick up the updated configuration.  I do see output
in the system logs about it failing to bind to port 22 when I execute "service
sshd restart" sometimes. 

Anyways, more extensive testing has convinced me that PermitRootLogin no does
appear to prevent scp logins, so my apologies for taking up your time with the bug.

Comment 3 Tomas Mraz 2005-10-04 15:16:33 UTC
> I do see output in the system logs about it failing to bind to port 22 when I 
> execute "service sshd restart" sometimes. 

This is bug 120302 and it should be harmless.

Note You need to log in before you can comment on or make changes to this bug.