{"id":385,"date":"2009-02-12T23:57:05","date_gmt":"2009-02-12T22:57:05","guid":{"rendered":"http:\/\/mattiesworld.gotdns.org\/weblog\/2009\/02\/12\/ftp-copying-outside-chroot-jail\/"},"modified":"2009-02-12T23:57:05","modified_gmt":"2009-02-12T22:57:05","slug":"ftp-copying-outside-chroot-jail","status":"publish","type":"post","link":"https:\/\/mattiesworld.gotdns.org\/weblog\/2009\/02\/12\/ftp-copying-outside-chroot-jail\/","title":{"rendered":"FTP: copying outside chroot jail"},"content":{"rendered":"<p>Your typical ftp setup will allow your users to only copy\/modify stuff in their own home dir (=chroot jail). Which makes sense. However, from time to time, you&#8217;ll want to access directories outside your home dir and then the following workaround can come in handy. Concretely, I have a few hard disks in my box, so, from time to time, I want to write directly to another partition than my home partition because of space constraints.<\/p>\n<p>Obviously, you can allow root to access ftp, but we&#8217;d like to avoid that if possible, right? Simply making a symbolic link in our home dir also doesn&#8217;t work because of the chroot jail. <\/p>\n<p>What you can do however, is mount a directory in another place. Suppose I have a \/dev\/sdb1 which is mounted to \/mnt\/data. I want to have access to the download dir on that drive. Then I can do:<\/p>\n<blockquote><p><code>mount --bind \/mnt\/data\/download \/home\/mattie\/download<\/code><\/p><\/blockquote>\n<p>to access this from my home dir. you can use the -r option to make it read-only if you wish (though doesn&#8217;t make much sense in my scenario). I suppose it might also work using hard links but I didn&#8217;t try that as I didn&#8217;t need a permanent link. Using mount, the link simply disappears on the next reboot.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Your typical ftp setup will allow your users to only copy\/modify stuff in their own home dir (=chroot jail). Which makes sense. However, from time to time, you&#8217;ll want to access directories outside your home dir and then the following workaround can come in handy. Concretely, I have a few hard disks in my box, &hellip; <a href=\"https:\/\/mattiesworld.gotdns.org\/weblog\/2009\/02\/12\/ftp-copying-outside-chroot-jail\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">FTP: copying outside chroot jail<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,10],"tags":[],"class_list":["post-385","post","type-post","status-publish","format-standard","hentry","category-linux","category-tweaking"],"_links":{"self":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/posts\/385","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/comments?post=385"}],"version-history":[{"count":0,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/posts\/385\/revisions"}],"wp:attachment":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/media?parent=385"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/categories?post=385"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/tags?post=385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}