Vsftp directory and permissions for different accounts

Source: Internet
Author: User

Set up an FTP server for virtual users, to achieve different users with different home directories and permissions.

1. User Peter's home directory for/var/ftp/vuserdir/peter, he only download permissions, no other permissions (create directory, rename, delete, upload, etc.);

2. User Ken's home directory is/var/ftp/vuserdir/ken, and he has all the privileges.

Configuration:

# 创建本地用户(用于映射虚拟用户) useradd  -d  /var/ftp/vuserdir  -s  /sbin/nologin  vuser # 为虚拟用户peter和ken创建虚拟目录 mkdir  -m 555  /var/ftp/vuserdir/peter mkdir  -m 755  /var/ftp/vuserdir/ken  # 改变属主和属组 chown  -R vuser:vuser  /var/ftp/vuserdir/  # 创建虚拟用户文件(/etc/vsftpd/vftpuser.txt),内容如下 peter 111 ken 222  # 生成虚拟用户数据库文件 db_load -T -t  hash  -f  /etc/vsftpd/vftpuser .txt  /etc/vsftpd/vftpuser .db # 安全起见,修改权限 chmod  600  /etc/vsftpd/vftpuser .db  # 修改/etc/pam.d/vsftpd文件,注释原来的内容,添加以下内容 auth    required         /lib/security/pam_userdb .so db= /etc/vsftpd/vftpuser account required         /lib/security/pam_userdb .so db= /etc/vsftpd/vftpuser # 用以下内容替换/etc/vsftpd/vsftpd.conf文件原来的内容 listen=YES pam_service_name=vsftpd user_config_dir= /etc/vsftpd/user_config guest_enable=YES guest_username=vuser anonymous_enable=NO local_enable=YES  # 创建虚拟用户配置文件目录 mkdir  /etc/vsftpd/user_config  # 为虚拟用户peter创建个人配置文件(/etc/vsftpd/user_config/peter),内容如下 local_root= /var/ftp/vuserdir/peter  # 为虚拟用户ken创建个人配置文件(/etc/vsftpd/user_config/ken),内容如下: local_root= /var/ftp/vuserdir/ken write_enable=YES anon_upload_enable=YES anon_mkdir_write_enable=YES anon_other_write_enable=YES  # 重启vsftpd服务: service vsftpd restart

Vsftp directory and permissions for different accounts

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.