{"id":754,"date":"2015-07-25T20:18:56","date_gmt":"2015-07-25T20:18:56","guid":{"rendered":"http:\/\/eltonoverip.com\/blog\/?p=754"},"modified":"2017-09-13T06:25:37","modified_gmt":"2017-09-13T06:25:37","slug":"ftp-server-on-debian","status":"publish","type":"post","link":"https:\/\/eltonoverip.com\/blog\/2015\/07\/ftp-server-on-debian\/","title":{"rendered":"FTP server on Debian"},"content":{"rendered":"<p>In this page, I will show you how to setup a basic FTP server in Debian.  We will be using Pure-FTPd.<\/p>\n<p>Before install, check for existing FTP services.<\/p>\n<pre>\r\n<code>ps aux | grep ftp<\/code>\r\n<\/pre>\n<p>Check if you have an existing FTP server already installed (and not running?).  Look for those lines that begins with &#8220;i&#8221;; that means the package is already installed.  The &#8220;p&#8221; flag means it is a package that you can install.<\/p>\n<pre>\r\n<code>\r\nroot@ftp-server:~# aptitude search pure-ftp\r\np   mysqmail-pure-ftpd-logger                                                                  - real-time logging system in MySQL - Pure-FTPd traffic-logger\r\np   pure-ftpd                                                                                  - Secure and efficient FTP server\r\np   pure-ftpd-common                                                                           - Pure-FTPd FTP server (Common Files)\r\np   pure-ftpd-ldap                                                                             - Secure and efficient FTP server with LDAP user authentication\r\np   pure-ftpd-mysql                                                                            - Secure and efficient FTP server with MySQL user authentication\r\np   pure-ftpd-postgresql                                                                       - Secure and efficient FTP server with PostgreSQL user authentication\r\n<\/code>\r\n<\/pre>\n<p><\/p>\n<p>Install Pure-FTPd server with aptitude install pure-ftpd.  The install looks like this.<\/p>\n<pre>\r\n<code>\r\nroot@ftp-server:~# aptitude install pure-ftpd\r\nThe following NEW packages will be installed:\r\n  openbsd-inetd{a} pure-ftpd pure-ftpd-common{a}\r\n0 packages upgraded, 3 newly installed, 0 to remove and 0 not upgraded.\r\nNeed to get 432 kB of archives. After unpacking 999 kB will be used.\r\nDo you want to continue? [Y\/n\/?] Y\r\nGet: 1 http:\/\/ftp.us.debian.org\/debian\/ wheezy\/main openbsd-inetd amd64 0.20091229-2 [38.1 kB]\r\nGet: 2 http:\/\/ftp.us.debian.org\/debian\/ wheezy\/main pure-ftpd-common all 1.0.36-1.1 [185 kB]\r\nGet: 3 http:\/\/ftp.us.debian.org\/debian\/ wheezy\/main pure-ftpd amd64 1.0.36-1.1 [209 kB]\r\nFetched 432 kB in 0s (472 kB\/s)\r\nPreconfiguring packages ...\r\nSelecting previously unselected package openbsd-inetd.\r\n(Reading database ... 38866 files and directories currently installed.)\r\nUnpacking openbsd-inetd (from ...\/openbsd-inetd_0.20091229-2_amd64.deb) ...\r\nSelecting previously unselected package pure-ftpd-common.\r\nUnpacking pure-ftpd-common (from ...\/pure-ftpd-common_1.0.36-1.1_all.deb) ...\r\nSelecting previously unselected package pure-ftpd.\r\nUnpacking pure-ftpd (from ...\/pure-ftpd_1.0.36-1.1_amd64.deb) ...\r\nProcessing triggers for man-db ...\r\nSetting up openbsd-inetd (0.20091229-2) ...\r\n[ ok ] Stopping internet superserver: inetd.\r\n[info] Not starting internet superserver: no services enabled.\r\nSetting up pure-ftpd-common (1.0.36-1.1) ...\r\nSetting up pure-ftpd (1.0.36-1.1) ...\r\nStarting ftp server: Running: \/usr\/sbin\/pure-ftpd -l pam -O clf:\/var\/log\/pure-ftpd\/transfer.log -u 1000 -E -8 UTF-8 -B\r\n<\/code>\r\n<\/pre>\n<p><\/p>\n<p>You will need to create a new system group for pure-ftpd but before doing that check if there are existing groups.  Check \/etc\/groups if the name of the group you are planning to add already exist.<\/p>\n<p>Create a new system group for pure-ftpd.<\/p>\n<pre><code>groupadd ftpgroup<\/code><\/pre>\n<p><\/p>\n<p>Create a default FTP user that has no access to home directories and cannot drop into a shell.  You will not be prompted to create a password for this user.<\/p>\n<pre><code>useradd -g ftpgroup -d \/dev\/null -s \/etc ftpuser<\/code><\/pre>\n<p><\/p>\n<p>Create FTP users.  You will prompted to create a new password for this user as well.  The following example is an existing user and having it point to his existing home directory.<\/p>\n<pre><code>pure-pw useradd elton -u ftpuser -g ftpgroup -d \/home\/elton<\/code><\/pre>\n<p><\/p>\n<p>You can create FTP users with storage limits.  For more options check out the pure-pw man page, command is <code>man pure-pw<\/code>.<\/p>\n<pre><code>pure-pw useradd bill -u ftpuser -g ftpgroup -d \/home\/pubftp\/remo -N 10<\/code><\/pre>\n<p><\/p>\n<p>If you&#8217;re like me, you can sometimes create passwords on the fly and right away forget.  I mean, it is faster for me to randomly come up with complex passwords and not have to use a password generator.  Anyway, If you need to change it-<\/p>\n<pre><code>pure-pw passwd [username]<\/code><\/pre>\n<p>A reminder that <code>pure-pw passwd<\/code> is only for changing the FTP password.  You still need to use <code>passwd [username]<\/code> to change users password.<\/p>\n<p>To apply adds and changes with pure-ftpd, don&#8217;t forget to issue the command <code>pure-pw mkdb<\/code>.  The version of pure-ftpd that I have, version 1.0.36-1.1 does not need pure-pw mkdb after adding a new user. <\/p>\n<p>User info are stored in the <code>\/etc\/pure-ftpd\/pureftpd.passwd<\/code> database file.  Instead of checking that file, you can also list users with <\/p>\n<pre><code>pure-pw list<\/code><\/pre>\n<p><\/p>\n<p>If you are looking for info on one specific user, <code>pure-pw show [username]<\/code><\/p>\n<p>Here&#8217;s an example.<\/p>\n<pre>\r\n<code>\r\nroot@ftp-server:~# pure-pw show elton\r\n\r\nLogin              : elton\r\nPassword           : $1$pVSkjNe0$OVr6W4ArAcFTxsXWa8OGR1\r\nUID                : 1001 (ftpuser)\r\nGID                : 1001 (ftpgroup)\r\nDirectory          : \/home\/elton\/.\/\r\nFull name          :\r\nDownload bandwidth : 0 Kb (unlimited)\r\nUpload   bandwidth : 0 Kb (unlimited)\r\nMax files          : 0 (unlimited)\r\nMax size           : 0 Mb (unlimited)\r\nRatio              : 0:0 (unlimited:unlimited)\r\nAllowed local  IPs :\r\nDenied  local  IPs :\r\nAllowed client IPs :\r\nDenied  client IPs :\r\nTime restrictions  : 0000-0000 (unlimited)\r\nMax sim sessions   : 0 (unlimited)\r\n<\/code>\r\n<\/pre>\n<p><\/p>\n<p>Notice <code>\/home\/elton\/.\/<\/code> in the Directory value.  The .\/ after the directory path means that chroot will prevent this user from going above or outside that directory.  This will make sense when you test FTP login using a FTP client. <\/p>\n<p>To save time, you can test your FTP login and server with<\/p>\n<pre><code>ftp 127.0.0.1<\/code><\/pre>\n<p><\/p>\n<p>Better still, get <a href=\"https:\/\/filezilla-project.org\/\" target=\"_blank\">FileZilla FTP Client<\/a>.<\/p>\n<p>To start, stop, restart, force-reload, and view status of pure-ftpd, begin your command with <code>\/etc\/init.d\/pure-ftpd<\/code><\/p>\n<pre>\r\n<code>\r\nroot@ftp-server:~# \/etc\/init.d\/pure-ftpd\r\nUsage: \/etc\/init.d\/pure-ftpd {start|stop|restart|force-reload|status}\r\n<\/code>\r\n<\/pre>\n<p><\/p>\n<p>Remember that SFTP and FTPS are not the same.  SFTP basically is FTP using SSH while FTPS uses TLS.  This means that if you&#8217;ve enabled SSH on the server (and for the user), then SFTP (port 22) will work as well.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this page, I will show you how to setup a basic FTP server in Debian. We will be using Pure-FTPd. Before install, check for existing FTP services. ps aux | grep ftp Check if you have an existing FTP server already installed (and not running?). Look for those lines that begins with &#8220;i&#8221;; that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,2],"tags":[],"class_list":["post-754","post","type-post","status-publish","format-standard","hentry","category-debian","category-linux"],"_links":{"self":[{"href":"https:\/\/eltonoverip.com\/blog\/wp-json\/wp\/v2\/posts\/754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eltonoverip.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eltonoverip.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eltonoverip.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eltonoverip.com\/blog\/wp-json\/wp\/v2\/comments?post=754"}],"version-history":[{"count":14,"href":"https:\/\/eltonoverip.com\/blog\/wp-json\/wp\/v2\/posts\/754\/revisions"}],"predecessor-version":[{"id":1204,"href":"https:\/\/eltonoverip.com\/blog\/wp-json\/wp\/v2\/posts\/754\/revisions\/1204"}],"wp:attachment":[{"href":"https:\/\/eltonoverip.com\/blog\/wp-json\/wp\/v2\/media?parent=754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eltonoverip.com\/blog\/wp-json\/wp\/v2\/categories?post=754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eltonoverip.com\/blog\/wp-json\/wp\/v2\/tags?post=754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}