Skip to content

Run without root

uFTP can run as a normal user. This is useful on embedded devices that have no root account, or to give the server fewer privileges.

Steps

  1. Use a port above 1024. Linux does not let a normal user listen on the standard port 21.

    FTP_PORT = 2000
    
  2. Keep the configuration in the directory you start it from. The server reads ./uftpd.cfg first and /etc/uftpd.cfg after, so you do not need /etc.

  3. Turn off what needs root.

    SINGLE_INSTANCE = false
    DAEMON_MODE = false
    

    Without these two options the server avoids the system calls that normal users cannot make. Run it from a terminal, a script or a service of your user.

  4. Make the users match your user. A normal user cannot change the owner of a file, so set the owner of the new files to the user that runs the server. If your user is pluto and the group is pluto:

    USER_0 = plutoftp
    PASSWORD_0 = a-long-secret
    HOME_0 = /home/pluto/
    USER_NAME_OWNER_0 = pluto
    GROUP_NAME_OWNER_0 = pluto
    
  5. Put the logs in a folder you can write, with a final /:

    LOG_FOLDER = /home/pluto/uFTP/logs/
    

Then start it as your user:

./uFTP

Note

ENABLE_PAM_AUTH (logging in system users) and the private key of the certificate need to be readable by your user. For FTPS, keep the key in a folder only your user can read.