Linux – proftpd initial directory for each user

ftplinuxproftpdUbuntu

After successfully setting up proftpd server, i want to add initial directory for each users, i have 2 user, webadmin that can access all folder and upload that can only access upload folder

...
# Added config
DefaultRoot                  ~
RequireValidShell            off
AuthUserFile                 /etc/proftpd/passwd

# VALID LOGINS
<Limit LOGIN>
   AllowUser webadmin, upload
   DenyALL
</Limit>

<Directory /home/webadmin>
   <Limit ALL>
      DenyAll
   </Limit>
   <Limit DIRS READ WRITE>
      AllowUser webadmin
   </Limit>
</Directory>

<Directory /home/webadmin/upload>
   <Limit ALL>
      DenyAll
   </Limit>
   <Limit DIRS READ WRITE>
      AllowUser upload
   </Limit>
</Directory>

All set ok, but i need to tell my ftp client initial directory for each user (otherwise it keep fail to retrieve directory), which i think it should be automatically set for each user (no need to type initial directory in ftp client)

Best Answer

It looks like you are setting their roots to their respective home directories I would recommend adding a symlink in their home folders that goes to the folder you want them directed to. (if you can just delete their home directories and symlink them as those folders. also you might need to allow access to their home folders. I think but am not sure.

UPDATE you could use two virtual hosts to break up the two users and then set the default root for each one.

<VirtualHost my.per-user.virtual.host.address>
 # the next line limits all logins to this virtual host, so that only
 anonftp users can connect

 <Limit LOGIN>
 DenyGroup !anonftp
 </Limit>

 # limit access to each user's anon-ftp directory, we want read-only
 except on incoming

 <Directory ~/anon-ftp>

 <Limit WRITE>
 DenyAll
 </Limit>

 </Directory>

 # permit stor access to each user's anon-ftp/incoming directory,
 but deny everything else

 <Directory ~/anon-ftp/incoming>

 <Limit STOR>
 AllowAll
 </Limit>
 <Limit READ WRITE>
 DenyAll
 </Limit>

 </Directory>

 # provide a default root for all logins to this virtual host.
 DefaultRoot ~/anon-ftp
 # Finally, force all logins to be anonymous for the anonftp group
 AnonymousGroup anonftp

 </VirtualHost>