Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Does anyone know of a way to do the following on Linux. I can't seem to find a way to run a script after the user is authenticated, but before the session starts...

  • User types username and password into GDM, LightDM, TTY, etc.
  • Rsync pulls their user's profile from a central server
  • User's session starts and they complete the days work normally
  • User logs out
  • Rsync updates user's profile on server

I can easily script everything listed above, I just don't know where to put the scripts to do this...

QA:

"Why not use NFS/CIFS/other-nas-protocol?"

High latency network, and spotty connection at times...

share|improve this question

1 Answer 1

up vote 4 down vote accepted

pam-script looks like a solution. A quote from the man page:

pam-script allows you to execute scripts during authorization, passwd changes, and on session opening or closing.

Such scripts can perform necessary tasks or influence the outcome of the PAM stack. For example, if the following entry was included in pam.conf

  sshd auth required pam_script

then if the script, pam_script_auth, exits with a non-zero value this would cause the user to be denied SSH access to the machine.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.