Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Our previous web server was Windows based, and it hosted multiple domains. As a result, if a user with name "username" wanted to log in via FTP to "example.com", they'd provide their username as "username@example.com".

We've modified things since then; our web server is now using CentOS 6, and our app no longer relies on FTP for anything. However, there may still be some stragglers out there who haven't updated, and I was curious if it's possible to set up some FTP users to emulate the old behavior, sort of as a little backwards compatibility until we know that no one's relying on it anymore. Trying to create a user with an '@' in their name results in the somewhat predictable:

useradd: invalid user name 'username@example.com'

It's probably not possible to coerce the system to accept a name like that, but I don't know if there's any system for something like those "virtual domains" when users log in that's anything similar to what we were doing on Windows.

share|improve this question
1  
What FTP daemon are you using? –  Wesley Apr 30 '12 at 20:06
    
Ah yes, that would be useful! I believe we're currently using proftpd. –  Doug Kavendek Apr 30 '12 at 20:44
add comment

2 Answers

up vote 2 down vote accepted

As you're using proftpd then you should be able to do this by creating virtual users and then using the ftpasswd program to create your usernames.

ftpasswd --passwd -name viain@localhost --uid=10001 --home=/home/viain --shell=/bin/false

which puts

viain@localhost:$1$nv2Ze6Tv$1EPpzsNBxkiwpAbBV9QMv1:10001:10001::/home/viain:/bin/false

into the AuthUserfile

share|improve this answer
    
I'm still a bit new to this linux server we're using, but I managed to get it working this way fairly easily. Thanks! –  Doug Kavendek May 2 '12 at 12:28
add comment

FTP users on CentOS can include the @ symbol in usernames depending entirely on the daemon that is serving FTP. For example, Midnight Commander allows the @ symbol in usernames if the option is properly enabled in a .netrc file. In some FTP daemons, the @ symbol is allowed in a username if the connection string replaces the @ with a plus sign.


HERP DERP

This isn't a problem with proftp, this is an issue with the username not being acceptable to useradd. DO not use useradd, use vipw instead to edit your passwd file and user the username with an 2 symbol. FTP does not have it's own userbase, but rather uses the /etc/passwd file's user list.

Some notes on usernames being added with useradd:

Similarly, if the username already exists in an external user database such as NIS or LDAP, useradd will deny the user account creation request.

Usernames may only be up to 32 characters long.

Furthermore, usernames have to begin with an alphanumeric character.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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