日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
如何在Linux中使用PAM添加密碼 (linux pam添加密碼)

How to add password authentication with PAM on Linux

成都創(chuàng)新互聯(lián)公司網(wǎng)站建設(shè)提供從項目策劃、軟件開發(fā),軟件安全維護、網(wǎng)站優(yōu)化(SEO)、網(wǎng)站分析、效果評估等整套的建站服務(wù),主營業(yè)務(wù)為成都做網(wǎng)站、成都網(wǎng)站設(shè)計,app軟件定制開發(fā)以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。成都創(chuàng)新互聯(lián)公司深信只要達到每一位用戶的要求,就會得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!

As the backbone of modern computing systems, security has become one of the most crucial aspects of mntning and managing Linux servers. Ensuring that users authenticate themselves before accessing sensitive data or systems is an essential part of this security process. One way to achieve this is by using Pluggable Authentication Modules (PAM), a powerful authentication framework that allows you to add authentication to various applications and services running on your Linux system. In this article, we will explore how to use PAM to add password authentication to a Linux server.

Understanding PAM

Before we dive into the process of adding password authentication with PAM, it is crucial to understand what PAM is and how it works. PAM is a modular authentication framework that separates the authentication process for different applications or services running on your system. PAM works by loading the appropriate authentication module(s) that correspond with a specific service request. These modules handle the authentication process and report back to the PAM framework on whether the authentication was successful or not. This approach makes it easy to configure different authentication methods depending on the service request or application.

Step 1: Installing the necessary PAM module

The first step in adding password authentication with PAM is to install the necessary PAM module. Depending on your Linux distribution, the PAM module required may differ. However, most Linux distributions include a PAM module for password authentication already installed by default. To install the module manually, you can use your distribution’s package manager. For example, if you are using Ubuntu or Debian, you can install the necessary module by running the following command:

sudo apt-get install libpam-modules

Step 2: Configuring PAM

Now that we have installed the necessary PAM module, we need to configure it to add password authentication. PAM configuration files are typically located in the /etc/pam.d/ directory. Each service or application has its own configuration file, and each file contns the PAM rules that specify the authentication mechani for that application or service.

In this example, we will add password authentication for SSH. The SSH PAM configuration file is located in /etc/pam.d/sshd. To add password authentication, we need to modify this file.

First, create a backup of the file using the following command:

sudo cp /etc/pam.d/sshd /etc/pam.d/sshd.bak

Next, open the SSH PAM configuration file using a text editor such as nano:

sudo nano /etc/pam.d/sshd

In the SSH PAM configuration file, you will see a list of PAM rules. To add password authentication, we need to add a new rule that specifies the PAM module for password authentication. This can be done by adding the following line at the beginning of the file:

auth required pam_unix.so

This PAM rule specifies that the authentication method used will be the traditional Unix password authentication method. Once you have added this line, save and close the file.

Step 3: Testing password authentication

Now that we have configured PAM for password authentication, we need to test it to ensure it is working as intended. To do this, you can try to SSH into your Linux server using a user account that has a password configured.

Once you try to SSH into the server, you should be prompted for a password. Once you enter the correct password, you should be granted access to the Linux server. If the password authentication does not work, review the SSH PAM configuration file and ensure you have followed the steps correctly.

Conclusion

By leveraging PAM, adding password authentication to your Linux server becomes an easy and effective process. PAM not only allows you to add password authentication, but it also enables you to configure various authentication methods to meet the specific needs of your applications and services. When coupled with other security measures, such as firewall configuration and a comprehensive backup strategy, PAM can help you build a robust and secure Linux environment for your organization.

相關(guān)問題拓展閱讀:

  • 如何在linux系統(tǒng)中設(shè)置嚴(yán)密的密碼策略
  • 為什么linux系統(tǒng)下修改密碼總說密碼不夠好

如何在linux系統(tǒng)中設(shè)置嚴(yán)密的密碼策略

用戶帳號管理是系統(tǒng)管理員最重要的工作之一。而密碼安全是系統(tǒng)安全中最受關(guān)注的一塊。在本教程中,我將為大家介紹如何在 Linux 上設(shè)置密碼策略。 假設(shè)你已經(jīng)在你的 Linux 系統(tǒng)上使用了 PAM (Pluggable Authentication Modules,插入式驗證模塊)…

為什么linux系統(tǒng)下修改密碼總說密碼不夠好

這是linux密碼策略決定的,建議用大寫+數(shù)字+特殊符號,這種策略是可以更改的,

1、使用配置文件/etc/pam.conf

該文件是由如下的行所組成的:

service-name module-type control-flag module-path arguments

service-name 服務(wù)的名字,比如telnet、login、ftp等,服務(wù)名字“OTHER”代表所有沒有在該文件中明確配置的其它服務(wù)。

module-type 模塊類型有四種:auth、account、session、password,即對應(yīng)PAM所支持的四種管理方式。同一個服務(wù)可以調(diào)用多個 PAM模塊進行認(rèn)證,這些模塊構(gòu)成一個stack。

control-flag 用來告訴PAM庫該如何處理與該服務(wù)相關(guān)的PAM模塊的成功或失敗情況。它有四種可能的 值:required,requisite,sufficient,optional。

required 表示本模塊必須返回成功才能通過認(rèn)證,但是如果該模塊返回失敗的話,失敗結(jié)果也不會立即通知用戶,而是要等到同一stack 中的所有模塊全部執(zhí)行完畢再將失敗結(jié)果返回給應(yīng)用程序??梢哉J(rèn)為是一個必要條件。

requisite 與required類似,該模塊必須返回成功才能通過認(rèn)證,但是一旦該模塊返回失敗,將不再執(zhí)行同一stack內(nèi)的任何模塊,而是直 接將控制權(quán)返回給應(yīng)用程序。是一個必要條件。注:這種只有RedHat支持,Solaris不支持。

sufficient 表明本模塊返回成功已經(jīng)足以通過身份認(rèn)證的要求,不必再執(zhí)行同一stack內(nèi)的其它模塊,但是如果本模塊返回失敗的話可以 忽略。可以認(rèn)為是一個充分條件。

optional表明本模塊是可選的,它的成功與否一般不會對身份認(rèn)證起關(guān)鍵作用,其返回值一般被忽略。

對于control-flag,從Linux-PAM-0.63版本起,支持一種新的語法,具體可參看LinuxPAM文檔。

module-path 用來指明本模塊對應(yīng)的程序文件的路徑名,一般采用絕對路徑,如果沒有給出絕對路徑,默認(rèn)該文件在目錄/usr/lib/security下面。

arguments 是用來傳遞給該模塊的參數(shù)。一般來說每個模塊的參數(shù)都不相同,可以由該模塊的開發(fā)者自己定義,但是也有以下幾個共同 的參數(shù):

debug 該模塊應(yīng)當(dāng)用syslog( )將調(diào)試信息寫入到系統(tǒng)日志文件中。

no_warn 表明該模塊不應(yīng)把警告信息發(fā)送給應(yīng)用程序。

use_first_pass 表明該模塊不能提示用戶輸入密碼,而應(yīng)使用前一個模塊從用戶那里得到的密碼。

try_first_pass 表明該模塊首先應(yīng)當(dāng)使用前一個模塊從用戶那里得到的密碼,如果該密碼驗證不通過,再提示用戶輸入新的密碼。

use_mapped_pass 該模塊不能提示用戶輸入密碼,而是使用映射過的密碼。

expose_account 允許該模塊顯示用戶的帳號名等信息,一般只能在安全的環(huán)境下使用,因為泄漏用戶名會對安全造成一定程度的威脅。

2、使用配置目錄/etc/pam.d/(只適用于RedHat Linux)

該目錄下的每個文件的名字對應(yīng)服務(wù)名,例如ftp服務(wù)對應(yīng)文件/etc/pam.d/ftp。如果名為xxxx的服務(wù)所對應(yīng)的配置文件/etc/pam.d/xxxx不存 在,則該服務(wù)將使用默認(rèn)的配置文件/etc/pam.d/other。每個文件由如下格式的文本行所構(gòu)成:

module-type control-flag module-path arguments

每個字段的含義和/etc/pam.conf中的相同。

由于公司使用的是RedHat的Linux故此我將使用pam.d這個配置目錄。密碼復(fù)雜度通過/etc/pam.d/system-auth這個文件來實現(xiàn)的故此我們先看一下默認(rèn)有什么內(nèi)容然后將這個文件備份一個:

在這個文件中我們會用到pam_cracklib.so這個模塊。pam_cracklib.so是一個常用并且非常重要的PAM模塊。該模塊主要的作用是對用戶密碼的強健性進行檢測。即檢查和限制用戶自定義密碼的長度、復(fù)雜度和歷史等。如不滿足上述強度的密碼將拒絕使用。

pam_cracklib.so比較重要和難于理解的是它的一些參數(shù)和計數(shù)方法,其常用參數(shù)包括:   

debug:將調(diào)試信息寫入日志;

type=xxx:當(dāng)添加/修改密碼時,系統(tǒng)給出的缺省提示符是“New UNIX password:”以及“Retype UNIX

password:”,而使用該參數(shù)可以自定義輸入密碼的提示符,比如指定type=your own word;

retry=N:定義登錄/修改密碼失敗時,可以重試的次數(shù);

Difok=N:定義新密碼中必須有幾個字符要與舊密碼不同。但是如果新密碼中有1/2以上的字符與舊密碼不同時,該新密碼將被接受;

minlen=N:定義用戶密碼的最小長度;

dcredit=N:定義用戶密碼中必須包含多少個數(shù)字;

ucredit=N:定義用戶密碼中必須包含多少個大寫字母;

lcredit=N:定義用戶密碼中必須包含多少個小些字母;

ocredit=N:定義用戶密碼中必須包含多少個特殊字符(除數(shù)字、字母之外)

linux pam添加密碼的介紹就聊到這里吧,感謝你花時間閱讀本站內(nèi)容,更多關(guān)于linux pam添加密碼,如何在Linux中使用PAM添加密碼,如何在linux系統(tǒng)中設(shè)置嚴(yán)密的密碼策略,為什么linux系統(tǒng)下修改密碼總說密碼不夠好的信息別忘了在本站進行查找喔。

成都服務(wù)器托管選創(chuàng)新互聯(lián),先上架開通再付費。
創(chuàng)新互聯(lián)(www.cdcxhl.com)專業(yè)-網(wǎng)站建設(shè),軟件開發(fā)老牌服務(wù)商!微信小程序開發(fā),APP開發(fā),網(wǎng)站制作,網(wǎng)站營銷推廣服務(wù)眾多企業(yè)。電話:028-86922220


新聞名稱:如何在Linux中使用PAM添加密碼 (linux pam添加密碼)
網(wǎng)站URL:http://www.dlmjj.cn/article/cdoeoss.html