2014-10-08 30 views
3

即使在chmodchown之後,我似乎也無法移動或刪除我的主目錄中的文件。即使在chown和chmod之後也不能移動或刪除文件

乍一看似乎權限設置正確。

[email protected]:~$ ls -lah 
total 32K 
drwxr-xr-x 18 user user 4.0K Oct 8 17:35 . 
drwxr-xr-x 16 root root 4.0K Oct 8 04:57 .. 
-rwxr-xr-x 1 user user 220 Apr 3 2012 .bash_logout 
-rwxr-xr-x 1 user user 3.5K Apr 3 2012 .bashrc 
drwxr-xr-x 2 user user 4.0K Oct 8 05:43 .matplotlib 
drwxr-xr-x 2 user user 4.0K Oct 8 17:19 .pip 
-rwxr-xr-x 1 user user 675 Apr 3 2012 .profile 
drwxr-xr-x 15 user user 4.0K Oct 8 04:58 .virtualenvs 

但我無法刪除現有文件。

[email protected]:~$ rm .bashrc 
rm: cannot remove `.bashrc': Operation not permitted 

所以我嘗試chownchmod,但它仍然無法正常工作。

[email protected]:~$ sudo chown -R $USER:$GROUP . 
[email protected]:~$ sudo chmod -R 755 .   
[email protected]:~$ rm .bashrc 
rm: cannot remove `.bashrc': Operation not permitted 
[email protected]:~$ mv .bashrc .virtualenvs/ 
mv: cannot move `.bashrc' to `.virtualenvs/.bashrc': Operation not permitted 

但是,我可以編寫和刪除新創建的文件就好了。

[email protected]:~$ echo 'hello' > test.txt 
[email protected]:~$ ls 
test.txt 
[email protected]:~$ rm test.txt 
+0

您是否嘗試過使用'./。bashrc'而不是'.bashrc'&'./。virtualenvs /'而不是'.virtualenvs /'? – Pallavi 2014-10-08 18:17:06

+0

不認爲這會有所作爲,但現在就給它一個嘗試和相同的結果。 – user1027169 2014-10-08 18:20:34

+0

這是一個正常的系統?沒有有趣的坐騎或掛載選項? 「mount」是什麼意思? 「id」是什麼意思? 'getfacl .bashrc'和'ls -dZ怎麼樣? .bashrc'? – 2014-10-08 19:07:00

回答

2

該文件上設置了任何不可變屬性?

lsattr .bashrc 

如果是這樣,你可以通過修復:

chattr -i -a .bashrc 

運行man chattr看標誌,或檢查wiki page

相關問題