Linux實踐工程師學習筆記十九

來源:互聯網
上載者:User

pam_limits.so的應用

1.查看協助檔案,確認它的設定檔位置,參數模式

#less /usr/share/doc/pam-0.99.3.0/txt/README.pam_limits

<domain>       <type>    <item>    <value>

<domain>       使用者名稱或組名

<type>           soft軟式節流

                     hard硬限制(不能達到的)

<item>           限制的內容,fsize檔案大小,nproc最大進程數,maxlogins使用者登入次數

2.將模組應用到sshd服務,修改服務檔案

#vi /etc/pam.d/sshd       添加

session required     pam_limits.so

session    控制使用者進程的登入次數,檔案大小,通過控制使用者的會話進程來限制使用者使用的資源

3.編緝pam_limits.so的設定檔

redhat     hard        maxlogins       2

(限制redhat登入到sshd服務的次數。

4.測試

#ssh -l redhat 192.168.0.22   第1個

#ssh -l redhat 192.168.0.22   第2個

表示同時最多可以有兩個redhat使用者登入

 

pam_rootok.so的應用

#chfn      改變使用者的finger資訊

普通使用者使用這個命令修改資訊時,需要輸入密碼才能使用,而root使用者則不需要。

分析:

#more /etc/pam.d/chfn

第一行為auth sufficient pam_rootok.so

因為chfn的pam服務檔案的第一行應用了pam_rootok.so模組,所以當root使用者使用chfn時不需驗證,不需要再往下,直接通過。

pam_userdb.so模組需要一個db資料庫儲存使用者資訊,具體如何使用可參考前面的vsftpd虛擬使用者。

在使用PAM模組時,注意參考README.pam協助。

相關文章

聯繫我們

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