misc/161714: SSHD starts on boot even if sshd_enable="NO" in 8.2

John Blazek freebsd.org at logicalsolutns.com
Sun Oct 16 16:00:24 UTC 2011


>Number:         161714
>Category:       misc
>Synopsis:       SSHD starts on boot even if  sshd_enable="NO" in 8.2
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 16 16:00:23 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     John Blazek
>Release:        8.2
>Organization:
>Environment:
>Description:
Followup to previous report:

After tracking this down further, it appears to be directly related to an entry in /etc/rc.local

/usr/sbin/sshd -p 22200


This entry is intended to start a separate instance of sshd for administrator access.

When this entry is commented out with hash #, no sshd process starts.
When the hash is removed, sshd starts on both port 22200 and port 9991


*BOOTED WITH #/usr/sbin/sshd -p 22200  in rc.local
[root at kahlua]:[~]# cat /etc/rc.local
#/usr/sbin/sshd -p 22200
sysctl kern.securelevel=2



result: no sshd running. inetd listening on 2220

[root at kahlua]:[~]# sockstat | grep ssh
[root at kahlua]:[~]# sockstat | grep 2220
root     inetd      45432 5  tcp4   *:2220                *:*
[root at kahlua]:[~]#


Then manually executing the command starts sshd as expected:

[root at kahlua]:[~]# /usr/sbin/sshd -p 22200
[root at kahlua]:[~]# sockstat | grep ssh
root     sshd       56999 3  tcp6   *:22200               *:*
root     sshd       56999 4  tcp4   *:22200               *:*
[root at kahlua]:[~]#


*************************************************************************

Removed Hash from rc.local, to start copy of ssh on port 22200

[root at kahlua]:[~]# cat /etc/rc.local
/usr/sbin/sshd -p 22200
sysctl kern.securelevel=2
[root at kahlua]:[~]#


This resulted in an 'extra' copy of sshd starting (using the flag -p 9991 from rc.conf)

[root at kahlua]:[~]# cat /etc/rc.conf | grep ssh
# sshd is controlleb by inetd
sshd_enable="NO"
sshd_flags="-p 9991"


[root at kahlua]:[~]# sockstat | grep ssh
root     sshd       33493 3  tcp6   *:9991                *:*
root     sshd       33493 4  tcp4   *:9991                *:*
root     sshd       7532  3  tcp6   *:22200               *:*
root     sshd       7532  4  tcp4   *:22200               *:*

[root at kahlua]:[~]# sockstat | grep 2220
root     inetd      49601 5  tcp4   *:2220                *:*
root     sshd       7532  3  tcp6   *:22200               *:*
root     sshd       7532  4  tcp4   *:22200               *:*

>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list