系統加固之--鎖定使用者

來源:互聯網
上載者:User

標籤:style   檔案   os   2014   for   io   

/********************************************************************* * Author  : Samson * Date    : 07/06/2014 * Test platform: *              Linux ubuntu 3.8.0-42-generic #62~precise1-Ubuntu *              GNU bash, version 4.2.24(1)-release * *******************************************************************/

在系統加固中,要對一些不需要登入的使用者進行鎖定,使其不能夠登入到shell,以執行系統的其他動作,那麼對這個功能進行配置通過以下兩種方法進行配置:

0、將/etc/passwd檔案中的shell網域設定成/bin/false;

1、將/etc/passwd檔案中的shell網域設定成/usr/sbin/nologin;


而這兩種方式的區別在於一個可以進行登入ftp,一個不能夠登入;

下面就這兩種配置進行測試:

0-、建立立一個使用者為:testfalse;


0、以root許可權修改/etc/passwd檔案中的對應項中的shell項為:

testfalse:x:1001:1001:,,,:/home/testfalse:/bin/false

在root許可權下執行:

[email protected]:~# su testfalse

結果:沒有任務返回值;

那麼auth.log日誌的記錄是什麼呢:

Jul  5 12:46:10 ubuntu su[9785]: Successful su for testfalse by root
Jul  5 12:46:10 ubuntu su[9785]: + /dev/pts/1 root:testfalse
Jul  5 12:46:10 ubuntu su[9785]: pam_unix(su:session): session opened for user t
estfalse by v0idp0int(uid=0)
Jul  5 12:46:10 ubuntu su[9785]: pam_unix(su:session): session closed for user testfalse


1、以root許可權修改/etc/passwd檔案中的對應項中的shell項為:

testfalse:x:1001:1001:,,,:/home/testfalse:/usr/sbin/nologin

切換使用者到testfalse下執行:

su testfalse

結果:

[email protected]:~$ su testfalse
This account is currently not available.

那麼auth.log日誌的記錄是什麼呢:

Jul  5 13:02:31 ubuntu su[10700]: Successful su for testfalse by v0id
Jul  5 13:02:31 ubuntu su[10700]: + /dev/pts/3 v0id:testfalse
Jul  5 13:02:31 ubuntu su[10700]: pam_unix(su:session): session opened for user testfalse by v0id(uid=1000)
Jul  5 13:02:31 ubuntu nologin: Attempted login by v0id on /dev/pts/3
Jul  5 13:02:31 ubuntu su[10700]: pam_unix(su:session): session closed for user testfalse


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.