Re: [問題] selinux 的奇怪現象

看板Linux作者 (LYSin8)時間12年前 (2014/02/28 23:44), 編輯推噓1(108)
留言9則, 5人參與, 最新討論串2/2 (看更多)
可能的自問自答 使用的關鍵字 selinux no home directory but can cd http://kangry.com/topics/viewcomment.php?index=18540 裡面內容 I created a new /home directory (略) But then I get this: $ ssh 192.168.0.37 russell@192.168.0.37's password: Last login: Mon Apr 13 08:43:57 2009 from 192.168.0.11 Could not chdir to home directory /home/russell: Permission denied [russell@auxbackup /]$ cd [russell@auxbackup ~]$ pwd /home/russell To this my first reaction is WTF? ^^^^^跟我看到這個錯誤時的想法完全一樣 (略) chcon -t home_root_t /home ^^^^^這個可能可以解決問題吧 結論是我用了新的 home 而且又有 selinux 才會這樣 **更新,那個指令沒用,我還是把 selinux 關掉好了 期待專家能告訴我解法 XD -- Time waits for no one. ↑ (。A。)ハァ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.48.126 ※ 編輯: johnjohnlin 來自: 140.112.48.126 (02/28 23:48)

02/28 23:56, , 1F
試試restorecon這個指令把selinux label重標成預設的
02/28 23:56, 1F

02/28 23:58, , 2F
ls -Z可以看到label,另外cp -a複製比較好會連label一起複製
02/28 23:58, 2F

03/01 00:02, , 3F
所以就說重標label啊... 你純cp光聽知道label跑了
03/01 00:02, 3F

03/01 11:12, , 4F
請問要怎麼作呢?我自己在用的 distro 都沒有 selinux
03/01 11:12, 4F

03/01 11:12, , 5F
所以完全不知道怎麼設定...
03/01 11:12, 5F

03/01 12:09, , 6F
如果不在意重開機,想要省事的話,可以用:
03/01 12:09, 6F

03/01 12:09, , 7F
touch /.autorelabel; reboot
03/01 12:09, 7F

03/02 00:17, , 8F
感謝樓上
03/02 00:17, 8F

06/06 01:05, , 9F
我用的是'restorecon -R -v /home /root',沒重開機。
06/06 01:05, 9F
文章代碼(AID): #1J4AxoEf (Linux)
文章代碼(AID): #1J4AxoEf (Linux)