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

Explain in detail the permission to create files in ftp

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

Share

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

Explain in detail the permission to create files in ftp

First, problems

There is such a requirement. Admin is a limited user created by a Linux for its FTP application. Through admin users can log in to the FTP service. After logging in to the FTP service, create a folder. The user and user group of the folder are admin, with an attribute of 755, that is, only the admin user has write permission. However, the FTP background is to upload files to the FTP server through b users logging in to the linux system execution program. Because the folders of the FTP server are all created by the admin user, and the attribute is 755 and the user does not have the permission to write at all, the program fails to upload the file.

2. Analysis

Then the solution to the problem should be easy. Since the default attribute of the directory created by the admin user is 755, just change the default attribute to 775 and add the b user to the user group to which admin belongs, and the problem will be solved.

Third, solve the problem

1. Because the default login user of the system is b, in order to facilitate testing, you need to log in to the admin user, and then create a folder to see if the default properties have changed. This account is currently not available is reported when the b user su to the admin user. Mistake. It occurred to me that when the admin user was created, the shell of the user was prohibited from logging in. Here, to facilitate testing, use the following command to enable shell login:

$sudo usermod-s / bin/bash admin

2. Then modify the system environment variable / etc/profile file to set umask to 002 (directory default attribute 777-002-775, file default attribute 666-002 = 664). After the source file takes effect, switch to the admin user-created folder to try: it is found that the default attribute of the directory has been changed to 755.

Drwxrwxr-x 2 admin admin 4.0K Dec 6 22:54 a

3. Then log in to FTP with admin, create a new folder and find that its permission is still 755

4. Because I am not familiar with FTP, I didn't want to go to FTP at first, but I was messing with various Linux user groups and user rights settings, and it was useless to try. Finally, calm down and think slowly, it suddenly occurred to me that the file attribute created by logging in to FTP with an admin account has always been 755, here only the FTP application is logged in, not shell, so it is not affected by the umask in the Linux environment variables, while the file attribute created after modifying the admin login shell after umask is 775, here you log in to shell, there is no problem according to the value of umask. Now that the problem has been found, it is right to think that FTP should also have a setting similar to Linux umask, so I found the configuration file of FTP and found the following parameters:

5. Change the Umask value of FTP to 002, restart the FTP service, and find that the problem has been solved.

Note: although the problem is small, it has been solved relatively quickly, warn yourself! Before messing with some application services, we must first fully understand and be familiar with the data configuration of these application services, and do not be too quick, otherwise, if there are problems, we do not know where to investigate.

Thank you for reading, hope to help you, thank you for your support to this site!

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