how to setup sftp log ?


how to setup sftp log ?

 将sftp 的日志记入/var/log/sftp.log

需要升级openssh
centos 直接yum
yum -y update  zlib* openssl* openssh*


其它系统需要编译升级:
最新版本ssh 条件为:
Zlib 1.1.4 or 1.2.1.2 or greater (ealier 1.2.x versions have problems):
http://www.gzip.org/zlib/

OpenSSL 0.9.6 or greater:
http://www.openssl.org/

(OpenSSL 0.9.5a is partially supported, but some ciphers (SSH protocol 1
Blowfish) do not work correctly.)

本文zlib 为1.3满足要求
只升级ssl ssh

update openssl
wget http://www.openssl.org/source/openssl-0.9.8l.tar.gz
tar zxvf openssl-0.9.8l.tar.gz
 cd openssl-0.9.8l
more INSTALL
./config --help
 ./config --prefix=/usr/local/openssl
./config -t
make
make test
echo $?
make install

update openssh
wget http://openbsd.cs.pu.edu.tw/OpenSSH/portable/openssh-5.3p1.tar.gz
tar zxvf openssh-5.3p1.tar.gz
cd openssh-5.3p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/openssl/ --with-pam --with-md5-passwords --with-zlib
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bk
 make
 make install

service sshd restart

ssh -V
OpenSSH_5.3p1, OpenSSL 0.9.8l 5 Nov 2009

#config sftp
修改:/etc/ssh/sshd_config
# override default of no subsystems
Subsystem       sftp    /usr/lib64/ssh/sftp-server -l INFO -f AUTH
<红色字体为添加>

修改:/etc/syslog.conf
添加
auth,authpriv.*                                         /var/log/sftp.log


重启服务:
service syslog restart
service sshd restart

查看:
# tail /var/log/sftp.log
Jan 25 21:32:28 nagios sshd[24619]: Connection closed by UNKNOWN
Jan 25 21:37:28 nagios sshd[25120]: Connection closed by UNKNOWN

error:
configure: error: PAM headers not found
需要安装PAM包
wget http://www.kernel.org/pub/linux/libs/pam/library/Linux-PAM-1.1.0.tar.bz2
tar jxvf Linux-PAM-1.1.0.tar.bz2
 cd Linux-PAM-1.1.0/
 ./configure
make
make check
 make install

你可能感兴趣的:(linux,log,职场,sftp,休闲)