We want to create a personal bin directory in all user's home location.
Is there any way to create a ~/bin folder by default, when we create users for the first time?
You can do in the shell like this:
cd /home && for user in * ; do sudo mkdir $user/bin && sudo chown $user $user/bin ; done
But be warned ! I'm making a couple of (very reasonable) assumptions here:
You probably don't really want all users but only the users with a home-directory that is a subdir in
/home (A lot of system services are bound to "special" users like ntp, mail, www-data, ...)
Every subdir in
/home is probably the homedir of a user with the same name
You want the owner of every
bin-dir to be the same as the user of which the home-dir is. If on your system every user has a group with the same name and you also want to set the group of
bin correctly then change
chown $user to