[sftp-server]

If it doesn't fit in another category, ask it here.
Post Reply
FORESTHUS
Posts: 3
Joined: 2005/07/24 10:39:00

[sftp-server]

Post by FORESTHUS » 2006/06/21 08:16:11

Hi to all,

I´ve got very bothering failure, but I habe got no idea where to look and solve.

I build following packages on Centos4.3:

openssl-0.9.8a.tar.gz
openssh-4.3p2.tar.gz

Than I created a script ofr /etc/init.d/sshd43p2
[code]#!/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.
#
# 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/sshd43p2.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
}

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


ps -ef |grep sshd | cut -b10-14 | xargs -l kill -9
ps -ef |grep sftp-server | cut -b10-14 | xargs -l kill -9


my_success "sshd43p2 stopping" "sshd"
echo "Stopped sshd43p2:"
else
my_failure "sshd43p2 startup" ""
echo "Stopping sshd43p2:"
fi
;;
restart)
$0 stop
$0 start
;;
status)
status sshd
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac

exit 0[/code]

Than I ran the /etc/init.d/sshd43p2. Evrything is OK, but after some time i get a defunct.

This is my sshd_config:

[code]# $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $

# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/ssl/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
# default value.

Port 22
Protocol 2,1
#AddressFamily any
ListenAddress 192.168.27.56
#ListenAddress ::

# HostKey for protocol version 1
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

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO
LogLevel DEBUG

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
MaxAuthTries 6

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys

# For this to work you will also need host keys in /usr/local/ssl/etc/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication mechanism.
# Depending on your PAM configuration, this may bypass the setting of
# PasswordAuthentication, PermitEmptyPasswords, and
# "PermitRootLogin without-password". If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=no
#UsePAM no

#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
UseDNS no
#PidFile /var/run/sshd.pid
PidFile /var/run/sshd43p2.pid
#MaxStartups 10
#PermitTunnel no

# no default banner path
#Banner /some/path

# override default of no subsystems
Subsystem sftp /usr/local/ssl/libexec/sftp-server

# only wanted user can connect
AllowUsers max moritz tom huck

[/code]

[b]What am I doing wrong??[/b]

:-(

Post Reply

Return to “CentOS 4 - Miscellaneous Questions”