DirectAdmin 1.52.2+ will support a new feature that automates this for you:
If you have /home and /home2, and want to be able to create Users to either directory, with the choice in a package, do the following.
Note: Assumes CentOS and /etc/default/useradd for default home control.
1) Create a Custom Packages Item listbox for the homedir.
nano /usr/local/directadmin/data/admin/custom_package_items.confand add the following code:
homedir=type=listbox&item1txt=/home&item1val=/home&item2txt=/home2&item2val=/home2&string=Select from List&desc=Select desired home path.&default=/home2Note the default is set to /home2. Use /home if you wish.
Be sure to re-save all of your User packages so they have the homedir set.
2) Create the script to change the /etc/default/useradd file:
nano /usr/local/directadmin/scripts/custom/user_create_pre.shand add the code
3) Lastly, use this to set it back after each creation:
nano /usr/local/directadmin/scripts/custom/user_create_post.shand add the code:
© 2018 JBMC Software, Suite 173 3-11 Bellerose Drive, St Albert, AB T8N 1P7 Canada. Mon-Fri 9AM-5PM MST