CentOS 7.4 Configuration SFTP Service

Source: Internet
Author: User
Tags ftp file centos file permissions sftp access
Service Build

CentOS with SSH service, direct configuration can SFTP configuration 1. Create a user group SFTP

Groupadd SFTP
2. Create User
Useradd-g sftp-s/sbin/nologin-d/home/sftp/ftpuser1 ftpuser1

-G Join to SFTP Group
-S Prohibit login
-d The login directory for the specified user 3. Set Password

passwd Ftpuser1
4. Create user ftp file directory
Mkdir/home/sftp/ftpuser1
5. Modify folder owner
Chown-r Ftpuser1:sftp/home/sftp/ftpuser1
6. Modify the SSH configuration file

Modify Sshd_config as follows:
Note the original subsystem settings

#Subsystem Sftp/usr/libexec/openssh/sftp-server

Enable Internal-sftp
subsystem SFTP INTERNAL-SFTP

Restrict user sftp access to root directory
Restricting the root directory of Ftpuser1 users

Match User ftpuser
chrootdirectory/home/sftp
forcecommand    internal-sftp
7. Restart SSH service
Systemctl Restart sshd
matters needing attention (pit)

There are two key points to a directory's permissions setting

Directories that are specified by Chrootdirectory to start up to the system root directory owners can only be root
The directory specified by Chrootdirectory is not allowed to have group write permissions to modify file permissions until the system root directory is started

You can use a similar code to modify directory access permissions:

Chmod-r 544/home/sftp/ftpuser1
Related Article

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.