2

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....

3
  • OK SOLVED. (that was silly...) --> Desktop, Templates and other dirs are configured at first login. Sep 23, 2018 at 6:06
  • 1
    That'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.) Sep 23, 2018 at 7:44
  • 2
    Next 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.
    – marcelm
    Sep 23, 2018 at 12:46

1 Answer 1

9

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.

2
  • when I do that I get the new.user home dir without Desktop and Templates folder... how can I add those folders? 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 via mkdir /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. Sep 23, 2018 at 6:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .