Postcreate doesn't parse variables
Via the web interface (Configuration -> Miscellaneous -> Hooks) I have added this line in the POSTCREATE field for posixAccount:
/usr/bin/sudo /etc/fusiondirectory/mkhomedir.sh %uid %homeDirectory
Now, when I add a posixAccount to a user (that does not have a homedir yet) and try to save I get this error:
Cannot execute 'POSTCREATE' command (/usr/bin/sudo /etc/fusiondirectory/mkhomedir.sh %uid %homeDirectory) for plugin posixAccount!
The content of mkhomedir.sh is this:
#!/bin/sh mkdir $2 chown $1:$1 $2
The file can be executed because in sudoers I have this:
www-data ALL=(ALL) NOPASSWD: /etc/fusiondirectory/mkhomedir.sh
And the permissions on the file are correct too:
-rwxr-x--- 1 www-data www-data 34 Apr 11 22:53 mkhomedir.sh
Judging the error it seems like the variables %uid and %homeDirectory simply do not get parsed. This also seems from /var/log/auth.log:
May 9 18:57:42 nurdservices sudo: www-data : TTY=unknown ; PWD=/usr/share/fusiondirectory/html ; USER=root ; COMMAND=/etc/fusiondirectory/mkhomedir.sh %uid %homeDirectory
(from redmine: issue id 2378, created on 2013-05-09, closed on 2013-05-10)
- Custom Fields:
- Bug in version: 1.0.5