Skip to main content
2 of 2
added mention of not using shell unless it needs shell access, per comment
geekosaur
  • 32.9k
  • 5
  • 84
  • 59

Very roughly:

# cp /etc/passwd /etc/passwd.bak # just in case you e.g. forget one of the >s
# echo 'ftpuser:x:1000:1000:ftp user:/home/ftpuser:/bin/sh' >>/etc/passwd
# cp /etc/shadow /etc/shadow.bak
# echo 'ftpuser:x:15020:0:99999:7:::' >>/etc/shadow
# cp /etc/group /etc/group.bak
# echo 'ftpuser:x:1000:' >>/etc/group
# cp /etc/gshadow /etc/gshadow.bak
# echo 'ftpuser:x:1000:' >>/etc/gshadow
# passwd ftpuser
# mkdir /home/ftpuser
# chown ftpuser:ftpuser /home/ftpuser

You should of course make sure the username, user id, and group id are available. Also, unless the account needs shell access for some reason, set the shell to something like /bin/false or /sbin/nologin (if the latter is available).

geekosaur
  • 32.9k
  • 5
  • 84
  • 59