Hot answers tagged


As suggested, this is fairly easy to accomplish. On the terminal you could use a for loop like this: for i in {20001..20100}; do useradd -u $i -g 1000 -d /home/app/mnt/$i "user${i}"; done The loop is incremented up to 20100 and then it quits.


The -M flag for useradd means "do not create the user's home directory", so the program has done what you asked. You can fix the problem by creating a home directory for Alice and copying in the template files: home=$(getent passwd Alice | cut -d: -f6) uid=$(getent passwd Alice | cut -d: -f3) gid=$(getent passwd Alice | cut -d: -f4) mkdir -m755 "$home" cp -...


As thrig pointed out, all that's needed is to create the directory structure that you want under /etc/skel. Quoting from the useradd man page -k, --skel SKEL_DIR The skeleton directory, which contains files and directories to be copied in the user's home directory, when the home directory is created by useradd. This option is only valid if the -m ...

Only top voted, non community-wiki answers of a minimum length are eligible