Setting FTP chroot directory

Discussion in 'Mac OS X Server, Xserve, and Networking' started by marcusg, Mar 6, 2013.

  1. marcusg macrumors newbie

    Sep 15, 2005
    I'm trying to set up FTP on a Mac Mini (Mountain Lion, non-server version). I'm trying to chroot a user to another directory than the user's home directory. Let's call him aaron, homedir = /Users/aaron and desiered chroot upon ftp-login = /some/other/dir.

    - I've added aaron to /etc/ftpchroot
    - I've added the following line to /etc/ftpd.conf
    - - chroot aaron /some/other/dir

    As far as I can understand, that should put aaron in /some/other/dir. But when loggin in, aaron is chrooted in /Users/aaron! Why? Can't [pathformat] be a normal path (see )?
  2. assembled macrumors regular

    Jan 12, 2009
    from here

    The file /private/etc/ftpchroot is used to determine which users will have their session's root directory changed (using chroot(2)), either to the directory specified in the ftpd.conf(5) chroot directive (if set), or to the home directory of the user. If the file does not exist, the root directory change is not performed.
  3. HenryAZ macrumors 6502a


    Jan 9, 2010
    South Congress AZ
    Shouldn't the second word be a class keyword, rather than the user's name?
  4. marcusg thread starter macrumors newbie

    Sep 15, 2005
    Thanks both of you! I hadn't fully understood the usage of class. You made me study the manual a little bit more and now i nailed it! I added "aaron allow myclass" to ftpusers and modified ftpd.conf to contain "chroot my class /some/other/dir". I also removed the entry in ftpchroot.

    ... and (shame on me) after copying the line from ftp.conf to ftpd.conf (apparently I made a typo when opening the file in the first place!) it all worked perfect!
  5. bpesquet macrumors newbie


    Dec 24, 2016
    Extra info: be careful to use the same class name in ftpusers and ftpd.conf and to set an absolute path for the new FTP home in ftpd.conf (e.g. /Users/youruser/subfolder)

    Thanks for this useful thread.

Share This Page