can anybody tell me how to create a ubuntu user with having '@'. With help of bellow link I found how to add period in username but haven't found any clue for '@' yet.

What are the disadvantages of having a dot in a user name?

  • 3
    Do the same thing it says, but use @ instead of \. in the regex.
    – muru
    Mar 20, 2017 at 12:00

1 Answer 1


not sure why you would want to use such character in the user name, but here is one way (for username foo@t):

# useradd -m foo@t
# /bin/su - foo@t
$ id
uid=22284(foo@t) gid=22284(foo@t) groups=22284(foo@t)

then to set a password

# passwd foo@t

to delete such user (and all her/his files):

# userdel -r foo@t
  • That backslash is unnecessary - the shell will just translate that to @. Try echo @ \@
    – muru
    Mar 20, 2017 at 12:31
  • yes, you are indeed correct, not sure whether it's best to edit original answer or leave it to these comments ... Mar 20, 2017 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.