[Bug 1051] error: Bind to port 22 on 0.0.0.0 failed: Address already in use.

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Thu Jun 2 22:45:36 EST 2005


http://bugzilla.mindrot.org/show_bug.cgi?id=1051

           Summary: error: Bind to port 22 on 0.0.0.0 failed: Address
                    already in use.
           Product: Portable OpenSSH
           Version: 4.1p1
          Platform: ix86
               URL: http://www.tietoenator.de
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: P4
         Component: Build system
        AssignedTo: bitbucket at mindrot.org
        ReportedBy: gero.waldhausen at tietoenator.com


Hi,
I´ve got problems with openssl-0.9.7g.tar.gz and openssh-4.1p1.tar.gz!

Here is the way I compiled on "Fedora Core release 3 (Heidelberg)":

Packages I used are:
- openssl-0.9.7g.tar.gz
- openssh-4.1p1.tar.gz
- zlib-1.2.2.tar.gz

The DOING:
mkdir -p /var/empty
chown root:sys /var/empty
chmod 755 /var/empty

###################
- zlib-1.2.2.tar.gz
###################
tar -zxvf zlib-1.2.2.tar.gz
cd zlib-1.2.2
./configure --prefix=/usr/local/zlib-1.2.2
make
make install

########################
- openssl-0.9.7g.tar.gz
########################
tar -zxvf openssl-0.9.7g.tar.gz
cd openssl-0.9.7g
./config --prefix=/usr/local/openssl-0.9.7g
make
make install

######################
- openssh-4.1p1.tar.gz
######################
tar -zxvf openssh-4.1p1.tar.gz
cd openssh-4.1p1
./configure --prefix=/usr/local/ssl  --with-zlib=/usr/local/zlib-1.2.2 --with-
ssl-dir=/usr/local/openssl-0.9.7g
make
make install

###############################################
vi /usr/local/ssl/etc/sshd_config 
###############################################

#############################################################
+ New Entry
- Old Entry
- #Port 22
- #Protocol 2,1
+ Port 22
+ Protocol 2,1

 #ListenAddress 0.0.0.0
 #ListenAddress ::

 # HostKey for protocol version 1
- #HostKey /usr/local/ssl/etc/ssh_host_key
+ HostKey /usr/local/ssl/etc/ssh_host_key
 # HostKeys for protocol version 2
- #HostKey /usr/local/ssl/etc/ssh_host_rsa_key
- #HostKey /usr/local/ssl/etc/ssh_host_dsa_key
+ HostKey /usr/local/ssl/etc/ssh_host_rsa_key
+ HostKey /usr/local/ssl/etc/ssh_host_dsa_key

...

- #PidFile /var/run/sshd.pid
+ PidFile /var/run/sshd41.pid
#############################################################


Build a bigger key:

##########################################################################
/usr/local/ssl/bin/ssh-keygen -b 2048 -f /usr/local/ssl/etc/ssh_host_key -t 
rsa1 -P ""
/usr/local/ssl/bin/ssh-keygen -b 2048 -f /usr/local/ssl/etc/ssh_host_dsa_key -t 
dsa -P ""
/usr/local/ssl/bin/ssh-keygen -b 2048 -f /usr/local/ssl/etc/ssh_host_rsa_key -t 
rsa -P ""
##########################################################################

Build a startscript (/etc/init.d/sshd40)
########################################################################
#!/bin/sh
#
# chkconfig: 345 55 45
# description: sshd (secure shell daemon) is a server part of the ssh suite.
#       Ssh can be used for remote login, remote file copying, TCP port
#       forwarding etc. Ssh offers strong encryption and authentication.
#
# Version 10.05.2004 09:08 (g.waldhausen / Tietoenator AG)
# corrected version: 02.06.2005 11:20

# Source function library.
. /etc/rc.d/init.d/functions

[ -f /etc/sysconfig/sshd ] && . /etc/sysconfig/sshd

RETVAL=0

# Einstellungen
KEYGEN=/usr/local/ssl/bin/ssh-keygen
RSA1_KEY=/usr/local/ssl/etc/ssh_host_key
RSA_KEY=/usr/local/ssl/etc/ssh_host_rsa_key
DSA_KEY=/usr/local/ssl/etc/ssh_host_dsa_key
PID_FILE=/var/run/sshd41.pid

my_success() {
  local msg
  if [ $# -gt 1 ]; then
    msg="$2"
  else
    msg="done"
  fi
  case "`type -type success`" in
    function)
      success "$1"
    ;;
    *)
      echo -n "${msg}"
    ;;
  esac
}
my_failure() {
  local msg
  if [ $# -gt 1 ]; then
    msg="$2"
  else
    msg="FAILED"
  fi
  case "`type -type failure`" in
    function)
      failure "$1"
    ;;
    *)
      echo -n "${msg}"
    ;;
  esac
}
do_rsa1_keygen() {
        if ! test -f $RSA1_KEY ; then
                echo -n "Generating SSH1 RSA host key: "
                if $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null; then
                        my_success "RSA1 key generation"
                        echo
                else
                        my_failure "RSA1 key generation"
                        echo
                        exit 1
                fi
        fi
}
do_rsa_keygen() {
        if ! test -f $RSA_KEY ; then
                echo -n "Generating SSH2 RSA host key: "
                if $KEYGEN -q -t rsa -f $RSA_KEY -C '' -N '' >&/dev/null; then
                        my_success "RSA key generation"
                        echo
                else
                        my_failure "RSA key generation"
                        echo
                        exit 1
                fi
        fi
}
do_dsa_keygen() {
        if ! test -f $DSA_KEY ; then
                echo -n "Generating SSH2 DSA host key: "
                if $KEYGEN -q -t dsa -f $DSA_KEY -C '' -N '' >&/dev/null; then
                        my_success "DSA key generation"
                        echo
                else
                        my_failure "DSA key generation"
                        echo
                        exit 1
                fi
        fi
}

############################################################
# Einstellung geaendert durch g.waldhausen (Inveos CTH GmbH)
############################################################
case "$1" in
        start)
                echo -n "Starting sshd41: "
                if test -r /var/run/sshd41.pid && kill -0 
`cat /var/run/sshd41.pid`
#                       then echo "already running according 
to /var/run/sshd41.pid. Not started."
#                       my_failure "sshd startup" ""
                        then my_failure "sshd startup" ""
                        echo ""
                        SSHDPIDSUM=$(status sshd)
                        echo ">> "${SSHDPIDSUM}" <<"
                else /usr/local/ssl/sbin/sshd -
f /usr/local/ssl/etc/sshd_config -g 360
                        my_success "sshd startup" "sshd"
                        echo ""
                fi
                        touch /var/lock/subsys/sshd41
                ;;
        stop)
                if test -r /var/run/sshd41.pid && kill -0 
`cat /var/run/sshd41.pid`
                        then [ -f /var/run/sshd41.pid ] || exit 0
                        kill -TERM `cat /var/run/sshd41.pid`
                        rm -f /var/run/sshd41.pid
                        rm -f /var/lock/subsys/sshd41
                        my_success "sshd stopping" "sshd"
                        echo "Stopped sshd41:"
                else
                        my_failure "sshd startup" ""
                        echo "Stopping sshd41:"
                fi
                ;;
  restart)
        $0 stop
        $0 start
        ;;
  status)
        status sshd
        ;;
  *)
        echo "Usage: $0 {start|stop|restart|status}"
        exit 1
esac

exit 0
########################################################################


Set attributes and runlevel:
##################################
chmod 0755 /etc/init.d/sshd40

chkconfig --level 2345 sshd40 on
chkconfig --level 2345 sshd off
##################################




.........

Now the Failure:

Jun  2 11:33:06 linuxtest sshd[24819]: Accepted password for root 
from ::ffff:192.168.8.14 port 2477 ssh2
Jun  2 11:33:06 linuxtest sshd[24819]: subsystem request for sftp
Jun  2 12:08:28 linuxtest xinetd[13075]: START: telnet pid=9693 
from=192.168.8.14
Jun  2 12:13:57 linuxtest sshd[2865]: Received signal 15; terminating.
Jun  2 12:23:20 linuxtest sshd[9905]: Server listening on :: port 22.
Jun  2 12:23:20 linuxtest sshd[9905]: error: Bind to port 22 on 0.0.0.0 failed: 
Address already in use.
Jun  2 12:25:01 linuxtest sshd[9908]: Accepted password for root 
from ::ffff:192.168.8.14 port 2909 ssh2
Jun  2 12:25:01 linuxtest sshd[9908]: subsystem request for sftp
Jun  2 12:37:13 linuxtest sshd[9905]: Received signal 15; terminating.


...........

What am I doing wrong?????


Please help.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.




More information about the openssh-bugs mailing list