Tutorial on setting up FTP service in Linux and tutorial on linuxftp

Source: Internet
Author: User

Tutorial on setting up FTP service in Linux and tutorial on linuxftp

It is easy to create users in Linux, but these operations are not often performed. After a long time, it is easy to forget. By the way, Configure FTP. Statement: use Linux version release 5.6 and run it as the super administrator root.

1. Create a user and specify the group and main directory

Useradd-d/opt/reconciliation-s/sbin/nologin-g ftpGroup-G root ftpUser Resolution: useradd Add User ftpUser-d specify user root directory as/opt/reconciliation-s specify shell script as/sbin/nologin, shell logon is not allowed to create a group ftpGroup-g specify the root group PS: if there is a problem with the creation, you can delete and recreate userdel-r ftpUser

2. Set the password

Passwd ftpUser

3. Set the access permission chown ftpUser/opt/reconciliation/

Change ftp configuration file

Modify the configuration file/etc/vsftpd. conf and set or delete the comment:

Userlist_enable = NO

Anonymous_enable = NO

Chroot_list_enable = YES

Chroot_list_file =/etc/vsftpd/chroot_list

Open/etc/vsftpd/user_list and add a line:

FtpUser

Create a file/etc/vsftpd/chroot_list and add a line

FtpUser

Configure the user's ftp permission and access path restrictions:

Can I log on to the ftp System Using usertest? If the access fails, it indicates that our ftp is restricted. Open/etc/vsftpd. conf and search for userlist_enable, userlist_deny, and userlist_file. If userlist_deny = NO: only users in the userlist_file file can access ftp; If userlist_deny = YES: users listed in the userlist_file file cannot access the system through ftp. Userlist_enable is enabled for this function. Our system configuration is as follows:

Userlist_enable = YES

Userlist_deny = NO

Userlist_file =/etc/vsftpd/user_list

Therefore, you need to add the user to the/etc/vsftpd/user_list file, with each user row.

Because the main directory is created by the mpsp user and the usertest is a member of the mpsp group, usertest has the permission to add, delete, query, modify, and query by default. usertest is a member of the mpsp group, you have access permissions to all the paths under/home/mpsp (this is the default setting based on the permissions of each directory). After you log on to ftp, you will find that the usertest user can access other directories, in addition, the permission for the mpsp group is not allowed. We need to control the access range of the usertest user under the main directory. The method is as follows:

1. Run cd/etc/vsftpd to enter the ftp configuration file directory.

2. Edit this file in vi vsftpd. conf, find # chroot_list_enable = YES, and delete the # sign above to enable this restriction function.

Locate chroot_list_file: chroot_list_file =/etc/vsftpd/chroot_list

3. Edit the chroot_list file, add the user name you want to limit, one user row per row.

If vsftpd. conf is updated, restart ftp. The command is as follows:

[Root @ linux sir001 root] #/etc/init. d/vsftpd restart

Disable vsftpd: [OK]

Start vsftpd For vsftpd: [OK]

Start FTP service

Service vsftpd start

There are also two parameters: stop and restart.

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.