I'm trying set up an SSH service that uses
The problem is that is also jails any other non-privileged user who authenticates. To fix this, I attempted:
in the hope that PAM would then apply that line ONLY when a user authenticates as userA. There seemed to be no change in behaviour. "userA" was still jailed and so was the other account that I don't want jailed.
What am I missing that's preventing me from applying this
Ultimately, I am aiming for a small number of power-users to be able to SSH into a small number of jails in a one-to-one fashion:
and any account other than user{A,B,C} shall be logged in to the host, not to a jail.
pam_jail
to jail a specific user when they authenticate. The following /etc/pam.d/sshd file works great for jailing user userA into the jail rooted in /jail/jailA:
Code:
#
#
# PAM configuration for the "sshd" service
#
# auth
#auth sufficient pam_krb5.so no_warn try_first_pass
#auth sufficient pam_ssh.so no_warn try_first_pass
auth required pam_unix.so no_warn try_first_pass
# account
account required pam_nologin.so
#account required pam_krb5.so
account required pam_login_access.so
account required pam_unix.so
# session
#session optional pam_ssh.so want_agent
session required pam_jail.so dir=/jail/jailA
session required pam_permit.so
# password
#password sufficient pam_krb5.so no_warn try_first_pass
password required pam_unix.so no_warn try_first_pass
The problem is that is also jails any other non-privileged user who authenticates. To fix this, I attempted:
Code:
session required pam_jail.so dir=/jail/jailA user=userA
in the hope that PAM would then apply that line ONLY when a user authenticates as userA. There seemed to be no change in behaviour. "userA" was still jailed and so was the other account that I don't want jailed.
What am I missing that's preventing me from applying this
pam_jail
rule ONLY to that one user?Ultimately, I am aiming for a small number of power-users to be able to SSH into a small number of jails in a one-to-one fashion:
Code:
session required pam_jail.so dir=/jail/jailA user=userA
session required pam_jail.so dir=/jail/jailB user=userB
session required pam_jail.so dir=/jail/jailC user=userC
and any account other than user{A,B,C} shall be logged in to the host, not to a jail.