作者rghxh (rghxh)
看板Linux
標題[問題] bash中使用rsync的問題
時間Wed Jan 6 18:05:17 2016
各位大大好
小弟碰上一個問題是,
我想要在開機時跑一個bash檔
該檔案會用rsync去同步兩個資料夾 (從mount的disk到local資料夾)
自己試著跑 (root) 那個bash檔時很順利,
但開機時自動跑 (/etc/rc.local) 時,exclude-from的部分就會報錯:
以下是rsync指令:
rsync -avz --delete --delay-updates --exclude-from
'/path-to-file/exclude.txt' /src-path/ /dst-path/
以下是錯誤訊息:
rsync: failed to open exclude file /path-to-file/exclude.txt:
Permission denied (13)
rsync error: error in file IO (code 11) at exclude.c(1062) [client=3.0.6]
但指令中我使用的路徑都是絕對路徑,
也用了不同的身分去跑跑看或修改權限,
問題仍然持續,
請問是否有大大能夠幫忙解答?
感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 60.251.127.175
※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1452074721.A.F8B.html
→ Bellkna: 開機時mount了嗎 01/06 18:23
→ rghxh: 開了,有在rsync前先下df確認過,也有另外弄了一個情境 01/06 18:27
→ rghxh: 但exclude file在local的情境中試過 01/06 18:27
※ 編輯: rghxh (60.251.127.175), 01/06/2016 18:36:36
→ Bellkna: 調rc等級? 01/06 18:46
→ rghxh: 感謝大大!照著這篇的方法做就解了 01/06 19:25
推 kenduest: selinux, 老問題^_^ 01/07 12:58
→ kenduest: 但是解法不大好,不應該選擇關閉 01/07 12:59
→ danny8376: 倒也還好 沒在用selinux其實沒必要開XD 01/07 13:37
→ rghxh: 不太了解selinux這塊所以就先照著教學做,應該暫時關閉 01/07 14:28
→ rghxh: 用完再開回來就好了?還是有別的更安全的解法呢? 01/07 14:29
→ Bellkna: selinux沒用過 不過 應該像grsec一樣可以設例外清單 01/07 19:21
→ lantw44: 去 /var/log/audit/audit.log 找 =AVC 看是什麼問題? 01/07 22:21