The goal here is to create a script to easily manage reservation for a machine. When a user reserve the machine, it should be the only one able to access the machine for a given time (except admins of course).
I already found a solution with PAM. This single line in /etc/pam.d/sshd would have resolve my problem:
auth required pam_listfile.so item=user sense=allow file=/etc/ssh/sshd.allow onerr=fail
with the user login in /etc/ssh/sshd.allow
But it does not work at all:
$ cat /etc/ssh/sshd.allow
foo
$ tail -f /var/log/auth.log
Dec 1 12:12:05 mini sshd[2697]: Accepted publickey for bar from 192.168.0.11 port 58087 ssh2
Dec 1 12:12:05 mini sshd[2697]: pam_unix(sshd:session): session opened for user bar by (uid=0)
Here the /etc/pam.d/sshd file
# PAM configuration for the Secure Shell service
auth required pam_env.so # [1]
auth required pam_env.so envfile=/etc/default/locale
auth required pam_listfile.so item=user sense=allow file=/etc/ssh/sshd.allow onerr=fail
@include common-auth
account required pam_nologin.so
@include common-account
@include common-session
session optional pam_motd.so # [1]
session optional pam_mail.so standard noenv # [1]
session required pam_limits.so
@include common-password
I am running a Debian Squeeze box, I don't know if the behaviour of PAM is different with this.
grep PAM /etc/ssh/sshd_config? – MadHatter Dec 1 '10 at 11:40account,auth,password, andsession. – Ignacio Vazquez-Abrams Dec 1 '10 at 13:34