国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

selinux導致ftp上傳失敗 工作中的真實案例

2020-06-13 12:14:31
字體:
來源:轉載
供稿:網友
這是一臺squid代理服務器(一臺式機,安裝的是redhat 5.4 64位操作系統),每天下午4點一臺服務器通過ftp上傳主機數據庫巡檢報告到這臺代理PC機的一個用戶家目錄下的xunjian目錄下,這臺PC再通過發送郵件的方式將巡檢報告發給組內成員,進行巡檢
此為背景,之前的selinux設置的為Permissive,不料同事中午睡覺的時候,腳這么一碰,將這臺代理PC重啟了,重啟后,連續2天的巡檢報告都沒有通過郵件收到,趕緊解決吧

1、手動的執行ftp上傳動作,報如下錯誤: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、代理PC的oracle家目錄,肯定是有讀寫權限的,因為是代理PC重啟導致的,突然想到selinux若開啟的話,是不允許用戶的家目錄進行ftp的,需要將ftp_home_dir這個sebool打開,如下所示:

[root@squid ~]# getenforce
Enforcing
[root@squid ~]# getsebool -a | grep ftp_home_dir
ftp_home_dir --> off
[root@squid ~]# setsebool ftp_home_dir on

3、這時候去上傳,就可以成功了,如下所示

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、另外一種方式,就是將selinux設置為Permissive

[root@squid ~]# getenforce
Enforcing
[root@squid ~]# setenforce 0
[root@squid ~]# getenforce
Permissive

5、同時在/etc/rc.local中添加這么一行,那么下次系統重啟后,就不會發生這樣的情況了

[root@squid ~]# which setenforce
/usr/sbin/setenforce
[root@squid ~]# cat /etc/rc.local | tail -n 1
/usr/sbin/setenforce 0

好啦,這樣就順利解決問題了,希望對一些朋友有所幫助
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 左云县| 吉木萨尔县| 大邑县| 郑州市| 鄢陵县| 沛县| 长治县| 河西区| 呼伦贝尔市| 蓝田县| 山西省| 高州市| 安陆市| 驻马店市| 静宁县| 塘沽区| 双鸭山市| 大庆市| 北辰区| 临武县| 清水河县| 永年县| 汨罗市| 左贡县| 阜城县| 韶关市| 丽江市| 精河县| 青阳县| 莱州市| 砀山县| 湖南省| 简阳市| 绥江县| 安远县| 琼中| 蓝山县| 长沙县| 奉新县| 阿拉善盟| 平顶山市|