Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use vsftpd to specify a user-specified directory in Redhat Enterprise Linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Redhat Enterprise Linux how to use vsftpd to build a specified user-specified directory, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can get something.

one. Check the installation of vsftpd in Linux.

two. Turn off SELinux in the system and restart the computer

How to turn off SELinux:

Change the SELINUX= "" in the / etc/selinux/config file to disabled, and then restart.

If you do not want to restart the system, use the command setenforce 0

Note:

Setenforce 1 sets SELinux to enforcing mode

Setenforce 0 sets SELinux to permissive mode

Add selinux=0 to the startup parameters of lilo or grub, or you can turn off selinux

Setsebool ftpd_disable_trans 1

three. Create a user and specify a directory

# useradd-d / home/ftpdata3 ftp3

# passwd ftp3

Create a user ftp3 and specify its ftp directory as ftpdata3

# useradd-d / home/ftpdata3 ftp4

# passwd ftp4

Create a user ftp4 and specify its ftp directory as ftpdata4

Thus, ftp3 and ftp4 users are assigned to the appropriate folder.

four. Modify vsftpd.conf configuration file

Change anonymous_enable to NO to prevent anonymous upload

Remove comments from chroot_list_enable and chroot_list_file to prevent users from accessing the parent directory

five. Create the chroot_list file under / etc/vsftpd

After the establishment is complete, add the user ftp3,ftp4 to it so that it only allows access to the specified directory.

six. Start or restart the fto service.

# service vsftpd restart (start)

Once the startup is successful, you can access the ftp service.

Note: explanation in configuration file

Anonymous_enable=YES enables anonymous user login

Local_enable=YES enables local user login

Write_enable=YES enables write permission for upload

Local_umask=022 sets the uploaded file to user=rwx, group=, other=

In this way, after the user uploads the file, it cannot be deleted or modified. Because the user belongs to the group group.

The workaround is to set up local_umask=002.

The final file permission is 777-folder mask-local_umask mask

Anon_upload_enable=YES enables anonymous user upload permission

Unify the attributes of uploading files uploaded by users anonymously

Chown_uploads=YES

Chown_username=ftp

Set chroot configuration to prevent specific users from accessing the upper-level directory

Chroot_list_enable=YES

Chroot_list_file=/etc/vsftpd/chroot_list

If the userlist_enable=YES option is YES, users in / etc/vsftpd/user_list will be barred from accessing ftp. If it is NO, only users in user_list can access ftp.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report