0

I am aware that a new user's home directory can be created by doing sudo useradd -m -d /home/<username> <username>.

However, let's say that I also want to make another non-home directory for this user at /ssd/<username>, and I do not want to make it by hand each time I add a new user to the system. In other words, I do not want to do these separately:

  • useradd -m -d /home/<username> <username>
  • mkdir /ssd/<username>
  • change the directory permissions.

I would like to do all 3 in a single command.

Does useradd or adduser provide an option that can do this at the creation time of the user?

Giacomo1968
  • 58,727
5Pack
  • 101

1 Answers1

0

In /etc/login.defs there may be an entry - USERADD_CMD /usr/sbin/useradd.local. This is run after useradd. Edit the /usr/sbin/useradd.local file to create whatever you want and if required change the permissions..

Bob Goddard
  • 1,482