I tried to use both useradd and adduser to get a username typed as Firstname.Lastname. I tried also installing libuser and using luseradd, but also I got error. Is there a way to do that (of course it should be)? I'm trying to write a script that takes a list of users from a file and creates the new users there are in. I can do that with the simple username, but I need to list Firstname.Lastname. if I use: adduser --force-badname then I can get the user Firstname.Lastname but the home folder does not contain Desktop and Templates dirs.. as well if I use: useradd --create-home "john.doe" I can get the home folder but no Desktop and Templates inside....
-
OK SOLVED. (that was silly...) --> Desktop, Templates and other dirs are configured at first login.– pietro lettiCommented Sep 23, 2018 at 6:06
-
1That's what you were told in the answer from @NasirRiley. Please consider accepting it since it seems to have solved your problem. (Similarly with your other questions: please accept the answer that worked for you.)– Chris DaviesCommented Sep 23, 2018 at 7:44
-
2Next time, don't tell us that you got an error. Instead, tell us exactly what error you got. Without that information, we have to play the guessing game.– marcelmCommented Sep 23, 2018 at 12:46
Add a comment
|
1 Answer
The easiest way is to use to --force-badname
switch.
adduser firstname.lastname --force-badname
You'll get a message Allowing use of questionable username.
and then it will continue with creating the home directory and asking for the password.
-
when I do that I get the new.user home dir without Desktop and Templates folder... how can I add those folders? Commented Sep 23, 2018 at 5:51
-
2@pietroletti They will either be created at first login or if you want them to be created when the user is added: The files and directories that are created in the user's home when the user is added are located in
/etc/skel
. Create what you desire to be added in that directory viamkdir /etc/skel/Desktop
for example. They will then be created when the user is added. Do this before running the script that adds the users. Commented Sep 23, 2018 at 6:41