ssh tidbits

After running into situations where I needed users to be able to have an account on a machine but not be able to login via ssh, and not wanting to edit a configuration file every single time (one foul up could screw up while typing logging in for everyone), I went the route of altering the PAM configuration to externally administer username allow/denies.

I edited /etc/pam.d/sshd and added the following lines:
auth required pam_listfile.so item=user sense=deny file=/etc/ssh/sshd.deny onerr=succeed
auth required pam_listfile.so item=user sense=allow file=/etc/ssh/sshd.allow onerr=fail

Then, creating /etc/ssh/sshd.deny & /etc/ssh/sshd.allow files, which contained a userid per line.

Restarting ssh (/etc/init.d/sshd restart) and everything takes effect. Taken a step further, pushingthe /etc/ssh/sshd.deny and /etc/ssh/sshd.allow files from a centralized server through rsync makes administration alot easier.  Either that, or an NFS mount.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s