{"id":1,"date":"2007-09-06T17:18:56","date_gmt":"2007-09-06T10:18:56","guid":{"rendered":""},"modified":"2007-09-06T17:45:22","modified_gmt":"2007-09-06T10:45:22","slug":"hello-world","status":"publish","type":"post","link":"https:\/\/blog.iwayvietnam.com\/tuanta\/2007\/09\/hello-world\/","title":{"rendered":"ProFTPd Automated Home Dir Creation"},"content":{"rendered":"<p>I had a requirement to restrict who could log into a ftp server, to automatically create their home directory &#8211; but in a different directory thats set in LDAP &#8211; with the correct permissions, and then to chroot them into here. <a href=\"http:\/\/www.proftpd.org\/\">ProFTPd<\/a> with <a href=\"http:\/\/horde.net\/%7Ejwm\/software\/mod_ldap\/\">mod_ldap<\/a> happened to be the answer, although it took a little bit of fiddling to get the right settings, as below:<\/p>\n<pre><code>        LDAPServer ldap.example.com\r\n        LDAPDoAuth on \"ou=people,dc=example,dc=com\"\r\n             \"(&amp;(uid=%v)(objectclass=posixAccount))\"\r\n        LDAPDoUIDLookups on \"ou=people,dc=example,dc=com\"\r\n        CreateHome on 755\r\n        LDAPGenerateHomedir on\r\n        LDAPGenerateHomedirPrefix \/path\/to\/base\/dir\r\n        LDAPForceGeneratedHomedir on\r\n        RequireValidShell       no\r\n        DefaultRoot ~\r\n<\/code><\/pre>\n<p>You can easily set this to autogenerate the home directory from the <code>homeDirectory<\/code> attribute in LDAP by removing the <code>LDAPGenerateHomedirprefix<\/code> and <code>LDAPForceGeneratedHomedir<\/code> lines.  See <a href=\"http:\/\/www.proftpd.org\/docs\/directives\/linked\/by-name.html\">the docs<\/a> for more details on the directives.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had a requirement to restrict who could log into a ftp server, to automatically create their home directory &#8211; but in a different directory thats set in LDAP &#8211; with the correct permissions, and then to chroot them into here. ProFTPd with mod_ldap happened to be the answer, although it took a little bit<a class=\"more-link\" href=\"https:\/\/blog.iwayvietnam.com\/tuanta\/2007\/09\/hello-world\/\">Continue reading <span class=\"screen-reader-text\">&#8220;ProFTPd Automated Home Dir Creation&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1","post","type-post","status-publish","format-standard","hentry","category-tips","entry"],"_links":{"self":[{"href":"https:\/\/blog.iwayvietnam.com\/tuanta\/wp-json\/wp\/v2\/posts\/1"}],"collection":[{"href":"https:\/\/blog.iwayvietnam.com\/tuanta\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.iwayvietnam.com\/tuanta\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.iwayvietnam.com\/tuanta\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.iwayvietnam.com\/tuanta\/wp-json\/wp\/v2\/comments?post=1"}],"version-history":[{"count":0,"href":"https:\/\/blog.iwayvietnam.com\/tuanta\/wp-json\/wp\/v2\/posts\/1\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.iwayvietnam.com\/tuanta\/wp-json\/wp\/v2\/media?parent=1"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.iwayvietnam.com\/tuanta\/wp-json\/wp\/v2\/categories?post=1"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.iwayvietnam.com\/tuanta\/wp-json\/wp\/v2\/tags?post=1"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}