Linux implementation automatically creates FTP users and creates folders

Source: Internet
Author: User

To create a createuser.sh script file

#!/bin/sh

#传入的文件名

Name=$1

#创建该用户所对应的ftp文件夹/srv/ftp is the root directory of my FTP server

mkdir/srv/ftp/$name

#创建ftp用户组 for easy Management

/usr/sbin/groupadd FTP

#创建用户

/usr/sbin/useradd-g ftp-m-d/srv/ftp/$name-S/sbin/nologin $name

#修改用户的密码, the password defaults to the same as the user name

echo $name |passwd--stdin #name

#更改ftp目录的权限

Chown-r $name: ftp/srv/ftp/#name

#把新用户名追加到/etc/vsftpd/cgroot_list

Echo $name >>/etc/vsftpd/chroot_list

#重启ftp服务

/sbin/service vsftpd Restart

Linux implementation automatically creates FTP users and creates folders

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.