Setting up SFTP requires three parts: zlib (including Zlib,zlib-devel), OPENSSL,OPENSSH, required RPM package in CSDN
1. General Linux systems, including Rehat,centos, have the basic installation of OpenSSL
Detection: Which OpenSSL
Forced installation of Openssl-devel due to dependency issues
RPM-IVH--nodeps--force openssl-devel-0.9.8e-22.el5_8.4.x86_64.rpm
2. Install zlib related package, this step operation can also be used in the installation of OpenSSH detection, will prompt related error to you install Zlib
RPM-IVH--nodeps--force zlib-1.2.3-27.el6.x86_64.rpm
RPM-IVH--nodeps--force zlib-devel-1.2.3-27.el6.x86_64.rpm
3. Install OpenSSH and unzip openssh-5.4p1.tar.gz
Tar zxvf openssh-5.4p1.tar.gz
CD OPENSSH-5.4P1
./configure--with-ssl-dir=/usr/local/ssl #openssl的安装位置
Make
Make install
4. Configuration
(1) Modifying the sshd startup script
# vi/etc/init.d/sshd
Sshd=/usr/sbin/sshd
Switch
Sshd=/usr/local/sbin/sshd
(2) Modify the sshd configuration file, the configuration file location of the TAR package installation is/usr/local/etc/sshd_config
Cd/usr/local/etc
CP Sshd_config Sshd_config.bak
cp/etc/ssh/sshd_config/usr/local/etc/
VI sshd_config
# Override default of No subsystems
# Subsystem Sftp/usr/local/libexec/sftp-server
Subsystem sftp internal-sftp
Match Group SFTP #组名, single user can match user username
X11forwarding No
chrootdirectory/data/htdocs/#指定实际目录
Allowtcpforwarding No
Forcecommand internal-sftp
(3) Modify directory Permissions
Chown ROOT.SFTP/USR/BJ
Groupadd SFTP
useradd-d/usr/bj-s/bin/false-g sftp nb_bjuser
passwd Nb_bjuser
(4) Restart sshd service
Service sshd Restart
Linux uses OpenSSH to build sftp (including note points)