SELinux導致登入不進Linux系統的問題與解決__Linux

來源:互聯網
上載者:User

SELinux導致登入不進Linux系統的問題與解決

冷勝魁(Seaquester)
lengshengkui@gmail.com
2008-6-4


最近在做Linux USB啟動盤時遇到一個問題:用隨身碟啟動,輸入使用者名稱和密碼之後,螢幕快速的閃過一段提示,然後重新出現login>提示符,始終登入不進去。讓我鬱悶了好久,在網上搜尋了好久,也沒有找到答案。

後來我懷疑到SELinux(我的USB啟動盤是在Fedora Core 6下面做的,FC6裡面有SELinux,隨身碟的Rootfs裡面的檔案都是從FC6裡面copy過來的)。在隨身碟的 /var/log/messages 裡面看到這樣的資訊:

May  28 20:59:43 localhost kernel: audit(1168261183.296:4): avc:  denied  { entrypoint } for  pid=2118 comm="login" name="bash" dev=sda1 ino=77521 scontext=root:system_r:hotplug_t:s0-s0:c0.c1023 tcontext=root:object_r:file_t:s0 tclass=file
May  28 21:00:00 localhost kernel: audit(1168261200.421:5): avc:  denied  { entrypoint } for  pid=2120 comm="login" name="bash" dev=sda1 ino=77521 scontext=root:system_r:hotplug_t:s0-s0:c0.c1023 tcontext=root:object_r:file_t:s0 tclass=file

所以我嘗試著在隨身碟的系統裡面關掉SELinux,就可以登入進去了。

關閉方法:

1) 在grub.conf裡面加一個kenrnel的參數(selinux=0):kernel /boot/vmlinuz-2.6.18-1.2798.fc6 ro root=LABEL=ROOT_USB selinux=0

2)修改 /etc/selinux/config 檔案,將 SELINUX=Enforcing 改為 SELINUX=disabled。

進一步研究了一下 SELinux,發現,原來是因為Copy到隨身碟上面的檔案的security context變化了(用ls -Z就可以看到),應該在copy的時候加上-Z參數,如:
    cp -aZ <source> <dest>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.