Sunday, April 7, 2013

Linux adduser user@domain.tld with @ or . inside the userid and use it as an FTP account





If you want to add a new user to your linux box and it not contains any special char like an '@' or '.' there is no problem. In the other case you could not find an answer simply googling around. For this reason i have to make some tests on different kind of server (dedicated and vps ones). 

Via plesk or others gui i didn't find a way to add user with special chars inside the username, also via shell i had some problems with that. 

The final solution for me was using webmin or follow the instructions below:

# groupadd ftpusers
# adduser 1234455 -d /home/1234455 -G ftpusers
# passwd 1234455
# type and retype password
# chown 1234455:ftpusers /home/1234455/

Well, now you have a user without @extdomain.tld so to do that you have to modify two files:

/etc/passwd
/etc/shadow

edit in passwd:

old one
1234455:x:10005:505::/home/1234455:/bin/false
new one
1234455@extdomain.tld:x:10005:505::/home/1234455:/bin/false

edit the same in the shadow and be carefull when do that.

After doing these hacks you could access to your home directory via ftp using 1234455@extdomain.tld :)








Read more...