| How do I do stuff on user creation?
|
Status_203

msg:4126584 | 8:47 am on May 4, 2010 (gmt 0) | I'm fed up of manually setting up NFS shares :( How would I go about, on creating a user, creating some extra subdirectories in their home directory (is there a skeleton template somewhere) and adding some entries to /etc/fstab (I assume this will take some scripting to append the new entries to the end, but how do I trigger it?)
|
encyclo

msg:4126629 | 12:22 pm on May 4, 2010 (gmt 0) | The skeleton directory is usually /etc/skel - adduser can copy the contents of this directory when creating a user (note: I only know about Debian/Ubuntu, don't know if this is the same for other distros). For the rest, I guess you could write a bash shell script to automate everything.
|
lammert

msg:4126743 | 3:04 pm on May 4, 2010 (gmt 0) | /etc/skel is also the skeleton directory for the RedHat family Linux distributions. There is no integrated scripting in the adduser or useradd tools (on some systems adduser and useradd are different commands) where you can add the creation of mount points in the /etc/fstab directory. If you want to perform all actions in one pass, a container shell script is needed which calls the adduser program and some home made scripting to update the fstab file.
|
Status_203

msg:4126748 | 3:10 pm on May 4, 2010 (gmt 0) | Thanks encyclo - that's the easy part then, and I'm using Ubuntu (although I might be reverting to Kubuntu again as I keep finding that the preferences I want to set have been omitted in Ubuntu). Now, I can probably cobble together a script to append lines to fstab, but can anybody tell me how I trigger it on user creation?
|
Status_203

msg:4126752 | 3:14 pm on May 4, 2010 (gmt 0) | Never mind, I've got a new approach. Write a script to handle the lot. Pass in username, uid and gid, then the script can create the group, add the user and do the appending to fstab... and I have to run even fewer commands to setup a user (which I need to do on the commandline anyway because easy-to-use *&^%* Ubuntu won't let me specify a uid (not that it always worked in previous versions of Kubuntu anyway!)). <edit>Yay! I finally reached post 100!</yay> <edit again>I must have been typing while you were posting lammert. Thanks for confirming what I suspected</edit_again>
|
|
|