{"id":1419,"date":"2020-06-23T22:04:00","date_gmt":"2020-06-23T20:04:00","guid":{"rendered":"http:\/\/www.shukko.com\/x3\/?p=1419"},"modified":"2020-06-23T22:05:51","modified_gmt":"2020-06-23T20:05:51","slug":"configuring-proftpd-with-virtual-users-in-a-file","status":"publish","type":"post","link":"https:\/\/www.shukko.com\/x3\/2020\/06\/23\/configuring-proftpd-with-virtual-users-in-a-file\/","title":{"rendered":"Configuring ProFTPd with virtual users in a file"},"content":{"rendered":"\n<p><strong>proftpd kurulumu su sekildedir:<\/strong><\/p>\n\n\n\n<p>apt-get install proftpd<\/p>\n\n\n\n<p>nano \/etc\/proftpd\/proftpd.conf<\/p>\n\n\n\n<p>ServerName &#8220;Debian&#8221;<br>DefaultRoot ~<br>Port 21<br>RootLogin off<br>AllowStoreRestart on<\/p>\n\n\n\n<p>Bununla test et<\/p>\n\n\n\n<p>proftpd -t<\/p>\n\n\n\n<p>service proftpd restart<\/p>\n\n\n\n<p>calistir gitsin<\/p>\n\n\n\n<p><strong>Sanal kullanicilar ile kolay kurulum duzenegi:<\/strong><\/p>\n\n\n\n<p>nano \/etc\/proftpd\/proftpd.conf<\/p>\n\n\n\n<p>DefaultRoot ~<br>RequireValidShell off<br>AuthUserFile \/etc\/proftpd\/ftpd.passwd<br>AuthGroupFile \/etc\/proftpd\/ftpd.group<br>AuthOrder mod_auth_file.c<\/p>\n\n\n\n<p>Kullanici Olustur:<\/p>\n\n\n\n<p>ftpasswd &#8211;passwd &#8211;file=\/etc\/proftpd\/ftpd.passwd &#8211;name=test &#8211;uid=60 &#8211;gid=60 &#8211;home=\/srv\/ftp\/test\/ &#8211;shell=\/bin\/false<\/p>\n\n\n\n<p>Grup Olustur:<\/p>\n\n\n\n<p>ftpasswd &#8211;group &#8211;name=nogroup &#8211;file=\/etc\/proftpd\/ftpd.group &#8211;gid=60 &#8211;member test<\/p>\n\n\n\n<p>Bununla test et<\/p>\n\n\n\n<p>proftpd -t<\/p>\n\n\n\n<p>Sifre degistirmek icin:<\/p>\n\n\n\n<p>ftpasswd &#8211;passwd &#8211;file=\/etc\/proftpd\/ftpd.passwd &#8211;name=test &#8211;change-password<\/p>\n\n\n\n<p>kullanici silmek icin:<\/p>\n\n\n\n<p>ftpasswd &#8211;passwd &#8211;file=\/etc\/proftpd\/ftpd.passwd &#8211;name=test &#8211;delete-user<\/p>\n\n\n\n<p>Open the ProFTPd configuration in any text editor:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>sudo nano \/etc\/proftpd\/proftpd.conf<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Specify the parameters:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>12345<\/td><td><code>DefaultRoot ~<\/code><code>RequireValidShell off<\/code><code>AuthUserFile \/etc\/proftpd\/ftpd.passwd<\/code><code>AuthGroupFile \/etc\/proftpd\/ftpd.group<\/code><code>AuthOrder mod_auth_file.c<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>As you can see, only module mod_auth_file.c is used for authorization of users, so logins and passwords are taken only from \/etc\/proftpd\/ftpd.passwd file.<\/p>\n\n\n\n<p>Now create an example user, test:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>sudo ftpasswd --passwd --file=\/etc\/proftpd\/ftpd.passwd --name=test --uid=60 --gid=60 --home=\/srv\/ftp\/test\/ --shell=\/bin\/false<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>After this command, the \/etc\/proftpd\/ftpd.passwd file of the similar structure with \/etc\/passwd will be created.<br>UID and GID can be specified any, preferably except 0 (this is root) and those specified in \/etc\/passwd.<br>You can also specify the UID and GID similar to the user in \/etc\/passwd, for example, 33 as a www-data user, to provide similar rights to web files and specify the home directory of \/var\/www.<br>You can create users with the same UID and GID, different home directories and taking into account that they are not allowed to go above their directory level (DefaultRoot ~ parameter in the server configuration).<\/p>\n\n\n\n<p>Create an ftpd.group file:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>sudo ftpasswd --group --name=nogroup --file=\/etc\/proftpd\/ftpd.group --gid=60 --member test<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Let\u2019s check the configuration:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>sudo proftpd -t<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Restart ProFTPd to apply the changes:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>sudo \/etc\/init.d\/proftpd restart<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Since the passwords in the file are stored in encrypted form, you can change the password to the user as follows:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>sudo ftpasswd --passwd --file=\/etc\/proftpd\/ftpd.passwd --name=test --change-password<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>You can lock\/unlock the user (add\/remove the ! character in the ftpd.passwd file before the password hash, thereby making it impossible for the user to connect):<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>12<\/td><td><code>sudo ftpasswd --passwd --file=\/etc\/proftpd\/ftpd.passwd --name=test2 --lock<\/code><code>sudo ftpasswd --passwd --file=\/etc\/proftpd\/ftpd.passwd --name=test --unlock<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>You can delete the user as follows:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>sudo ftpasswd --passwd --file=\/etc\/proftpd\/ftpd.passwd --name=test --delete-user<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Open the ProFTPd configuration in any text editor:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>sudo nano \/etc\/proftpd\/proftpd.conf<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Specify the parameters:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>12345<\/td><td><code>DefaultRoot ~<\/code><code>RequireValidShell off<\/code><code>AuthUserFile \/etc\/proftpd\/ftpd.passwd<\/code><code>AuthGroupFile \/etc\/proftpd\/ftpd.group<\/code><code>AuthOrder mod_auth_file.c<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>As you can see, only module mod_auth_file.c is used for authorization of users, so logins and passwords are taken only from \/etc\/proftpd\/ftpd.passwd file.<\/p>\n\n\n\n<p>Now create an example user, test:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>sudo ftpasswd --passwd --file=\/etc\/proftpd\/ftpd.passwd --name=test --uid=60 --gid=60 --home=\/srv\/ftp\/test\/ --shell=\/bin\/false<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>After this command, the \/etc\/proftpd\/ftpd.passwd file of the similar structure with \/etc\/passwd will be created.<br>UID and GID can be specified any, preferably except 0 (this is root) and those specified in \/etc\/passwd.<br>You can also specify the UID and GID similar to the user in \/etc\/passwd, for example, 33 as a www-data user, to provide similar rights to web files and specify the home directory of \/var\/www.<br>You can create users with the same UID and GID, different home directories and taking into account that they are not allowed to go above their directory level (DefaultRoot ~ parameter in the server configuration).<\/p>\n\n\n\n<p>Create an ftpd.group file:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>sudo ftpasswd --group --name=nogroup --file=\/etc\/proftpd\/ftpd.group --gid=60 --member test<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Let\u2019s check the configuration:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>sudo proftpd -t<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Restart ProFTPd to apply the changes:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>sudo \/etc\/init.d\/proftpd restart<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Since the passwords in the file are stored in encrypted form, you can change the password to the user as follows:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>sudo ftpasswd --passwd --file=\/etc\/proftpd\/ftpd.passwd --name=test --change-password<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>You can lock\/unlock the user (add\/remove the ! character in the ftpd.passwd file before the password hash, thereby making it impossible for the user to connect):<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>12<\/td><td><code>sudo ftpasswd --passwd --file=\/etc\/proftpd\/ftpd.passwd --name=test2 --lock<\/code><code>sudo ftpasswd --passwd --file=\/etc\/proftpd\/ftpd.passwd --name=test --unlock<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>You can delete the user as follows:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>sudo ftpasswd --passwd --file=\/etc\/proftpd\/ftpd.passwd --name=test --delete-user<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>ftpasswd is a script written in Perl, usually located in \/usr\/sbin\/ftpasswd.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>proftpd kurulumu su sekildedir: apt-get install proftpd nano \/etc\/proftpd\/proftpd.conf ServerName &#8220;Debian&#8221;DefaultRoot ~Port 21RootLogin offAllowStoreRestart on Bununla test et proftpd -t service proftpd restart calistir gitsin Sanal kullanicilar ile kolay kurulum duzenegi: nano \/etc\/proftpd\/proftpd.conf DefaultRoot ~RequireValidShell offAuthUserFile \/etc\/proftpd\/ftpd.passwdAuthGroupFile \/etc\/proftpd\/ftpd.groupAuthOrder mod_auth_file.c Kullanici Olustur: ftpasswd &#8211;passwd &#8211;file=\/etc\/proftpd\/ftpd.passwd &#8211;name=test &#8211;uid=60 &#8211;gid=60 &#8211;home=\/srv\/ftp\/test\/ &#8211;shell=\/bin\/false Grup Olustur: ftpasswd &#8211;group &#8211;name=nogroup &#8211;file=\/etc\/proftpd\/ftpd.group [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1419","post","type-post","status-publish","format-standard","hentry","category-kategerisiz"],"_links":{"self":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts\/1419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/comments?post=1419"}],"version-history":[{"count":2,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts\/1419\/revisions"}],"predecessor-version":[{"id":1422,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts\/1419\/revisions\/1422"}],"wp:attachment":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/media?parent=1419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/categories?post=1419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/tags?post=1419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}