2017-04-24 54 views
0

這裏是與在Linux上配置PAM相關的問題; 爲了限制特定的遠程用戶只能從特定的IP使用SSH,我想使用PAM列表文件來實現它。 我用的配置上將/etc/pam.d/sshdPAM列表文件允許來自特定ip的特定用戶

auth required pam_listfile.so item=ruser sense=allow file=/etc/ssh.allow.users onerr=fail 

然後編輯/etc/ssh.allow.users下面內容文件:

[email protected] 

然後用ssh蒂姆@ targethost從10.12.34.230開始,但它不工作; 誰能告訴我什麼PAM item = ruser的用法?我猜ruser意味着遠程用戶,這就是爲什麼我在配置中配置user @ ip。

如果PAM listfile無法實現目標,有沒有其他方法可以做到這一點?順便說一句,我不喜歡使用sshd_config,因爲它需要重新啓動服務。

謝謝

回答

0

剛剛遇到你的問題,想評論它,雖然它是7個月大。

要限制一個特定的用戶,你可以在sshd_config中添加下面的行來做。

Match Address 10.12.34.230 User tim 
    PasswordAuthentication yes 
    ChrootDirectory /home/tim 
    X11Forwarding no 
    AllowTcpForwarding no 
相關問題