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 solve the problem of ftp upload failure caused by selinux

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

Share

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

This article mainly introduces "how to solve the failure of ftp upload caused by selinux". In the daily operation, I believe many people have doubts about how to solve the problem that selinux caused ftp upload failure. The editor consulted all kinds of information and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubt that "selinux leads to ftp upload failure". Next, please follow the editor to study!

1. Manually execute the ftp upload action and report the following error: 553 Could not create file.

Sshuser@station90.example.com:~/xunjian/0108 > ftp 192.168.1.123

Connected to 192.168.1.123.

220 (vsFTPd 2.0.5)

Name (192.168.1.123:oracle): oracle

331 Please specify the password.

Password:

230 Login successful.

Remote system type is UNIX.

Using binary mode to transfer files.

Ftp > binary

200 Switching to Binary mode.

Ftp > put xunjian_0108.zip

Local: xunjian_0108.zip remote: xunjian_0108.zip

229 Entering Extended Passive Mode (| 10717 |)

553 Could not create file.

2. The oracle home directory of the proxy PC must have read and write permissions, because it is caused by the restart of the proxy PC. It suddenly occurred to me that if selinux is enabled, the user's home directory is not allowed to ftp. You need to open the sebool of ftp_home_dir, as shown below:

[root@squid ~] # getenforce

Enforcing

[root@squid ~] # getsebool-a | grep ftp_home_dir

Ftp_home_dir-- > off

[root@squid ~] # setsebool ftp_home_dir on

3. Upload at this time and you can succeed, as shown below.

Sshuser@station90.example.com:~/xunjian/0108 > ftp 192.168.1.123

Connected to 192.168.1.123.

220 (vsFTPd 2.0.5)

Name (192.168.1.123:oracle): oracle

331 Please specify the password.

Password:

230 Login successful.

Remote system type is UNIX.

Using binary mode to transfer files.

Ftp > bi

200 Switching to Binary mode.

Ftp > put xunjian_0108.zip

Local: xunjian_0108.zip remote: xunjian_0108.zip

229 Entering Extended Passive Mode (| 19974 |)

150 Ok to send data.

100% | * | 577 KB 2.31 MB/s 00:00 ETA

226 File receive OK.

591290 bytes sent in 00:00 (2.18 MB/s)

4. Another way is to set selinux to Permissive

[root@squid ~] # getenforce

Enforcing

[root@squid ~] # setenforce 0

[root@squid ~] # getenforce

Permissive

5. Add such a line to / etc/rc.local at the same time, and this will not happen the next time the system is rebooted

[root@squid ~] # which setenforce

/ usr/sbin/setenforce

[root@squid ~] # cat / etc/rc.local | tail-n 1

/ usr/sbin/setenforce 0

At this point, the study on "how to solve the failure of ftp upload caused by selinux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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