Setting SFTP user access directory permissions under Linux

Source: Internet
Author: User

First, create a new user, and set the directory, prohibit Shell login

Useradd-m-d/home/wwwroot/licnlt-s/usr/sbin/nologin LICNLT

Nologin to confirm the location in advance, usually under/usr/sbin or/sbin (you can view the Nologin configuration of sshd in/etc/passwd)

Second, set the user password

passwd LICNLT

Third, set the user directory owner to root

Chown root:root/home/wwwroot/licnlt/    #目录只能由root所有chmod 755/home/wwwroot/licnlt            #目录不可以有群组写入权限

  

Iv. Modification of/etc/ssh/sshd_config files

#注释掉这行 #subsystem      sftp    /usr/libexec/openssh/sftp-server# add Subsystem sftp internal-sftp # At the end of the configuration file     Specifies that the Internal-sftpmatch user LICNLT #匹配用户 with the system comes with the SFTP service                     , and if multiple groups are to be matched, separate the groups with commas CHROOTDIRECTORY/HOME/WWWROOT/LICNLT /         #用chroot将指定用户的根目录, meaning of chroot

V. Restart the SSH service

Service sshd Restart

Six, the user login after entering the/HOME/WWWROOT/LICNLT is the user root directory, the root directory is unable to write, so first use root under/home/wwwroot/licnlt/new www directory, and set permissions 777

Mkdir/home/wwwroot/licnlt/www

Modify Directory Owners and permissions

Chown Licnlt:licnlt/home/wwwroot/licnlt/wwwchmod 777/home/wwwroot/licnlt/www

  

Setting SFTP user access directory permissions under Linux

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.