6

I've read about what charachers should usernames use, in linux, here: https://serverfault.com/a/578264/330936 but I would like to know if is there any problem if I will use the at sign "@" in my usernames. I will use it especially for my ftp accounts (I have a simple webserver with CentOS 7).

I don't want to be portable to other older versions of linux, nor other distros (maybe debian).

Is there any problem in using @ in usernames?

  • 17
    Why would you even want to do this? This has at least the potential to create all kind of problems. – Sven Oct 20 '17 at 8:15
  • 8
    Not to mention using Unix accounts in plain text FTP server login... If you really need FTP in 2017, your FTP server probably has another way of creating accounts. – Esa Jokinen Oct 20 '17 at 8:21
  • 11
    @MMPP: The thing is that these are not plain Linux user names but virtual ones coming from a database and the @domain.com is not really part of the user name per se but an indication were to look this user up. – Sven Oct 20 '17 at 8:40
  • 13
    @AnFi: The important thing is: The @domain is not part of the username itself, but an indication where to look the username up/which domain it belongs to. This is one of the reasons why having an @ as part of the actual username is such a bad idea. – Sven Oct 20 '17 at 9:12
  • 4
    By all that's holy, do not use FTP. Use sFTP instead and proper secure communications. – Shadur Oct 21 '17 at 14:36
28

I'd say it isn't good idea.

I'd recommend to use simple regex:

([a-z_][a-z0-9_]{0,30})

Check following links:

https://stackoverflow.com/questions/6949667/what-are-the-real-rules-for-linux-usernames-on-centos-6-and-rhel-6

https://unix.stackexchange.com/questions/157426/what-is-the-regex-to-validate-linux-users

13

Using '@' in a username would make it impossible to use that username as the local-part of an email address, so I would say that is not a good idea.

  • 27
    Awkward to use '@' in the local part of an email address? Yes. Will every MTA/MUA able to deal with it? Probably not. But it's neither impossible, nor invalid. "@"@example.com is a syntactically valid email address. – user433901 Oct 20 '17 at 12:43
  • 5
    You're lucky if you get to the MTA/MUA stage. Most forms that request your email addr won't accept that. – ikegami Oct 20 '17 at 15:19
  • 6
    @Billy C., Of course, but that's what the user would have to deal with. – ikegami Oct 20 '17 at 17:14
  • 2
    Many email applications make a number of assumptions about email addresses. For instance, it's not uncommon for them to assume the local part is case-insensitive. So while the official standard says that it can be case-sensitive, in practice that would cause problems, so it's de facto case-insensitive. – Barmar Oct 20 '17 at 18:03
  • 7
    This basically falls under the Interoperability Principle. Since we know that there are many email clients that can't handle special characters in the local part, you need to be conservative in what characters you use there. – Barmar Oct 20 '17 at 18:04

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