I am using a customized Redmine installation to manage projects. I have managed to hook the addition of new users and send the login information to a bash script I have. Below is my script:
#!/bin/sh UNAME=$1 UPASS=$2 wall "$UNAME $UPASS" useradd "$UNAME" echo "$UPASS" | passwd "$UNAME" --stdin usermod -g restricted "$UNAME"
Echo is a bash builtin so it will not show up in the process table when it shoots the password in. The problem is that I get a permission complaint from Redmine:
/opt/rms/redmine/new-user: line 5: /usr/sbin/useradd: Permission denied Only root can do that. /opt/rms/redmine/new-user: line 7: /usr/sbin/usermod: Permission denied
This obviously indicates that I need root permission or another method of doing this. So I attempted to set the UID bit with permissions 4755 on the file so it runs as root, and I get the same error as above. Any idea what is going on here?
My general situation is I aim to add new users to the project management system automatically as linux users, and then when they are added to a certain group I plan to hook it so that they get extended permissions that lets them access a Mercurial repository via SSH - so user management is handled completely via the front end.