Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have setup pam_mkhomedir so that users home directories are automatically created at their first login. But I also want to create directories on a different place like this.

  • /home/username (pam_mkhomedir can make this directory)
  • /scratch/username

As far as I know, having a script in /etc/profile.d can't manage this because normal users don't have write-permission on /scratch.

Does anyone know how to make this happen?

Thanks in advance.

share|improve this question
An suid script in /etc/profile? – Zoredache Mar 12 '13 at 23:13
Thank you! I'll go with pam_exec. – kjtanaka Mar 13 '13 at 0:07
up vote 1 down vote accepted

You can use pam_exec to trigger a script at login. In the script you can create the /scratch/username folder if it does not exist.

share|improve this answer
Thank you! pam_exec works perfectly. – kjtanaka Mar 13 '13 at 0:06

Your Answer


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.