Linux uses OpenSSH to build sftp (including note points)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.