May 9, 2009

Linux FTP-only account

This discusses the procedure on creating an ftp-only user. This is the simplest way I devised which took me a handful of research and trial and error since I did it on the machine itself and from a test server. Anyway, this is short and effectual.

step 1: create the group if not existing

groupadd groupname

step 2: create the user with its shell and group

useradd -G user -s /sbin/nologin groupname

/sbin/nologin shell was used to disable ssh access

step 3: assign the group's home directory

usermod -d /directory user

step 4: assign a password

passwd user

step 5: grant ownership to the user's directory

chown -R user:group /directory

step 6: secure the directory with your preferred access privileges

chmod -R 766 /directory

Test via ftp from a foreign machine
Test SSH also and it will give you nothing.