MEWBIES@:  Facebook  Twitter  G+  YouTube  DeviantArt  Forum  Wall
 SHARE:
    ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
   ██                                                                       ██
  █▌                           -   GLFTPD   -                                █▌
 █▌                                                                           █▌
 █                                                                            ▐▌
 █ glFTPd is my favorite FTP Server, for UNIX based systems, because of it    ▐▌
 █ being so configurable, plenty of support, tons of add-ons, very easy to    ▐▌
 █ install and just plain fun to play with :). glFTPd site is HERE.           ▐▌
 █                                                                            ▐▌
  glFTPd
 █                                                                            ▐▌
 █ NOTE: Though this tutorial was done using v2.01 (2005-12-25) it is still   ▐▌
 █ applicable and updated for the latest v2.04; just change any commands that ▐▌
 █ state '2.01' to 2.04 or the latest version. Always use the latest stable.  ▐▌
 █                                                                            ▐▌
 █ Don't let the length of this tutorial scare you; it really is very easy    ▐▌
 █ as I have included many notes and other how to's so you have a proper      ▐▌
 █ fully working glFTPd up and running :).                                    ▐▌
 █                                                                            ▐▌
 █ *I have made a condensed version of this tutorial HERE if you just want to ▐▌
 █ have the cmds and some examples without explanations.                      ▐▌
 █                                                                            ▐▌
 █ NOTES:                                                                     ▐▌
 █ ``````                                                                     ▐▌
 █ Once I got my paws on a Linux box this was the first thing I ever          ▐▌
 █ installed - before even reading one Linux manual (NOT a great method). I   ▐▌
 █ saw it had docs and thought 'I can do this'! Well those docs are for       ▐▌
 █ people that at least know the very basics of Linux. To save yourself a     ▐▌
 █ lot of hassle; at least know the basics. Here are a few places to learn    ▐▌
 █ some 'basic Linux': The commands are HERE. Some basics are HERE. And of    ▐▌
 █ course your best tool is HERE.                                             ▐▌
 █                                                                            ▐▌
 █ HUGE THANK YOU to the generous talented always helpful peeps in #glftpd    ▐▌
 █ and #pzs-ng on efnet (IRC) - *Search all the enclosed docs and Google it   ▐▌
 █ first for solutions to your problem/s before asking! Not everything is     ▐▌
 █ going to be documented as the README says "...has a zillion different      ▐▌
 █ options...". Don't let that worry you; as note it does says 'options'.     ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █ RECOMMENDATIONS                                                            ▐▌
 █ PREREQUISITES                                                              ▐▌
 █ INSTALLING GLFTPD                                                          ▐▌
 █ INETD ERROR?                                                               ▐▌
 █ STARTING GLFTPD SERVER                                                     ▐▌
 █ SETTING GLFTPD PERMS                                                       ▐▌
 █ LOGIN TO YOUR FTP FIRST VIA SSH                                            ▐▌
 █ THEN LOGIN TO YOUR FTP VIA AN FTP CLIENT                                   ▐▌
 █ CRONTAB                                                                    ▐▌
 █ CREATING YOUR SECTIONS FOR SERVER                                          ▐▌
 █ PREPARING FOR GLFTPD CONFIGURATIONS                                        ▐▌
 █ SECURITY STEP                                                              ▐▌
 █ CONFIGURING GLFTPD                                                         ▐▌
 █ USERS VIEW THEIR HOME DIRECTORY ONLY                                       ▐▌
 █ CUSTOMIZING YOUR MESSAGES                                                  ▐▌
 █ INSTALLING EXTRA SCRIPTS                                                   ▐▌
 █ UNDUPE FILES VIA SSH                                                       ▐▌
 █ DATED DIRECTORIES AUTOMATICALLY MADE                                       ▐▌
 █ GLFTPD LOGS                                                                ▐▌
 █ DENY .NFO & .DIZ UPLOAD IN ZIP DIRS & FORCE .SFV UPLOAD BEFORE .RARS       ▐▌
 █ MISC NOTES                                                                 ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █ RECOMMENDATIONS:                                                           ▐▌
 █ ````````````````                                                           ▐▌
 █ Since glFTPd is 'very' customizable I would first recommend:               ▐▌
 █ 1. Do not install via apt-get, aptitude etc. To be able to use glFTPd to   ▐▌
 █ its full potential manually install it. It's easy. It's all the various    ▐▌
 █ optional settings that you can do that will take a bit more work.          ▐▌
 █                                                                            ▐▌
 █ 2. Read the enclosed docs - even if you don't understand everything in     ▐▌
 █ them 'yet' when you come across a problem or setting that you will want to ▐▌
 █ do- it's most likely in the docs.                                          ▐▌
 █                                                                            ▐▌
 █ 3. If you are installing this on a remote box - download glFTPd to your    ▐▌
 █ own box so you have easy access to read all the docs and configuration     ▐▌
 █ files.                                                                     ▐▌
 █                                                                            ▐▌
 █ 4. Here are the 'some' of the enclosed docs that you 'need' to read:       ▐▌
 █ glftpd-LNX_2.01\README HERE                                                ▐▌
 █ glftpd-LNX_2.01\docs\glftpd.docs HERE                                      ▐▌
 █ glftpd-LNX_2.01\docs\glftpd-shelluser-howto.txt HERE                       ▐▌
 █ glftpd-LNX_2.01\docs\glftpd_faq.html HERE                                  ▐▌
 █ glftpd-LNX_2.01\docs\glftpd.conf-EXAMPLES HERE                             ▐▌
 █                                                                            ▐▌
 █ In v2.04 the above docs remain unchanged except \glftpd.conf-EXAMPLES.     ▐▌
 █ HERE are all v2.04 docs if you want to have a look (note I add on the      ▐▌
 █ extension '.txt' so they are readable in a browser).                       ▐▌
 █                                                                            ▐▌
 █ 5. There are many add-on scripts for glFTPd. HERE is a good place to       ▐▌
 █ start.                                                                     ▐▌
 █                                                                            ▐▌
 █ 6. You will need root (user with administration rights) to do almost all   ▐▌
 █ of this.                                                                   ▐▌
 █                                                                            ▐▌
 █ 7. If you need any OS upgrades - do them now. As I did them later and had  ▐▌
 █ to fix a few minor problems it created for glftpd.                         ▐▌
 █ su                                                                         ▐▌
 █ apt-get update && apt-get upgrade                                          ▐▌
 █                                                                            ▐▌
 █ 8. You'll need to know if your server is using inetd or xinetd as you'll   ▐▌
 █ be prompted during install to select one. To view which one you are        ▐▌
 █ running, make a note which one:                                            ▐▌
 █ ps aux | egrep '[xi]netd'                                                  ▐▌
 █ Or if you have netstat:                                                    ▐▌
 █ netstat -tulpn | grep LISTEN | egrep '[xi]netd'                            ▐▌
 █ Output will state which you are running, for example:                      ▐▌
 █ 0.0  0.1   2380   656 ?        Ss   Mar04   0:00 /usr/sbin/inetd           ▐▌
 █ 0 0.0.0.0:143             0.0.0.0:*               LISTEN      2444/inetd   ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █ PREREQUISITES:                                                             ▐▌
 █ ``````````````                                                             ▐▌
 █ To view what is already installed:                                         ▐▌
 █ dpkg -l                                                                    ▐▌
 █ Skip the ones that you have already and install the others:                ▐▌
 █ su                                                                         ▐▌
 █ apt-get install libncurses5-dev zip unzip openssl tcpd openbsd-inetd       ▐▌
 █ you might also need:                                                       ▐▌
 █ apt-get install inetutils-inetd tcp_wrappers                               ▐▌
 █ And if you are going to use a site bot (eggdrop):                          ▐▌
 █ apt-get install tcl8.5 tcl8.5-dev                                          ▐▌
 █ And if you are going to use pzs-ng zip script:                             ▐▌
 █ apt-get install cURL libssl-dev                                            ▐▌
 █ exit                                                                       ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █ INSTALLING GLFTPD:                                                         ▐▌
 █ ``````````````````                                                         ▐▌
 █ Check glFTPd site first for the latest version and for the OS and bit      ▐▌
 █ version you need. For my setup (Debian x86) this is what I did:            ▐▌
 █ wget http://glftpd.dk/files/glftpd-LNX_2.01.tgz                            ▐▌
 █ (Latest version now for Debian x86 is:                                     ▐▌
 █ http://www.glftpd.eu/files/glftpd-LNX-2.04_1.0.1e-2+deb7u3_x86.tgz)        ▐▌
 █ tar -zxvf glftpd-LNX_2.01.tgz                                              ▐▌
 █ rename glftpd--LNX_2.01 to glftpd for ease:                                ▐▌
 █ mv glftpd--LNX_2.01 glftpd                                                 ▐▌
 █ cd glftpd                                                                  ▐▌
 █ su                                                                         ▐▌
 █ ./installgl.sh                                                             ▐▌
 █ Note: As per the docs: If running installgl.sh more than once you will get ▐▌
 █ an error; please do the following to remove it and start over again:       ▐▌
 █ 1. edit /etc/inetd.conf, /etc/services and remove all glftpd instances.    ▐▌
 █ 2. rm /glftpd /etc/glftpd.conf -rf                                         ▐▌
 █                                                                            ▐▌
 █ It will reply and prompt you with a number of questions. Hit enter key if  ▐▌
 █ the default is what you want. Below is part of the log and all my replies  ▐▌
 █ in Bold:                                                                   ▐▌
 █                                                                            ▐▌
 █                ###  #     ##### ##### ####  ####        ###                ▐▌
 █               #   # #     #       #   #   # #   #      #   #               ▐▌
 █               #     #     ###     #   #   # #   #         #                ▐▌
 █               #  ## #     #       #   ####  #   #        #                 ▐▌
 █               #   # #     #       #   #     #   #       #                  ▐▌
 █                ###  ##### #       #   #     ####       #####               ▐▌
 █                                                                            ▐▌
 █                                                                            ▐▌
 █                     --== WE MAKE FILES TRANSFER ==--                       ▐▌
 █                                                                            ▐▌
 █                                                                            ▐▌
 █        -----------------------------------------------------------         ▐▌
 █                     GLFTPD INSTALLER v2.0.1 (linux)                        ▐▌
 █                                                                            ▐▌
 █             Originally done by jehsom and dn.                              ▐▌
 █             Made ready for the new era by turranius and psxc.              ▐▌
 █        -----------------------------------------------------------         ▐▌
 █ ...                                                                        ▐▌
 █                                                                            ▐▌
 █ Press <enter> to continue.                                                 ▐▌
 █                                                                            ▐▌
 █ 1. TCPD SETUP:                                                             ▐▌
 █ Do you wish to use tcpd? If you are not sure then you should not use it.   ▐▌
 █ If you decided to change this at a later time, please search for tcpd in   ▐▌
 █ glftpd.docs for the required changes.                                      ▐▌
 █ Use tcpd? [Y]es [N]o: Y                                                    ▐▌
 █                                                                            ▐▌
 █ 2. JAIL SETUP:                                                             ▐▌
 █ Do you want to run glftpd in a "Jailed" environment?  In this environment  ▐▌
 █ a private directory will be created and glftpd will be installed inside.   ▐▌
 █ Regular shell users will not be able to get inside this private directory. ▐▌
 █ The glftpd.conf is also moved inside for added security and a new group    ▐▌
 █ will be created so you and other users you specify can access glftpd       ▐▌
 █ through the shell.                                                         ▐▌
 █ Use a jailed environment? [Y]es [N]o: Y                                    ▐▌
 █                                                                            ▐▌
 █ Creating the jailed environment.                                           ▐▌
 █                                                                            ▐▌
 █ Please enter the private directory to install glftpd inside [/jail]: /jail ▐▌
 █                                                                            ▐▌
 █ Do you want to create a private group? If you say no then only root will   ▐▌
 █ be able to access glftpd. Otherwise you can add other shell users to the   ▐▌
 █ group so they can access glftpd from the shell.                            ▐▌
 █ Use a private group? [Y]es [No]: Y                                         ▐▌
 █                                                                            ▐▌
 █ Setting permissions on /jail . . .                                         ▐▌
 █                                                                            ▐▌
 █ What would you like your private group to be called? : mewbie              ▐▌
 █ Who should have access to glftpd? (separate with ,): doggie                ▐▌
 █                                                                            ▐▌
 █ *My note: That will create group mewbie on your shell and user doggie will ▐▌
 █ belong to that group.                                                      ▐▌
 █                                                                            ▐▌
 █ 3. GLFTPD BASE SETUP:                                                      ▐▌
 █ Please enter the directory inside /jail to install glftpd to [/glftpd]:    ▐▌
 █ /glftpd                                                                    ▐▌
 █                                                                            ▐▌
 █ Copying glftpd files to /jail/glftpd . . .                                 ▐▌
 █ Copying required binaries to /jail/glftpd/bin . . .                        ▐▌
 █ All binaries successfully copied.                                          ▐▌
 █ Making glftpd's /dev/null & /dev/zero . . . Done.                          ▐▌
 █                                                                            ▐▌
 █ 4. SERVICE SETUP & MULTI-INSTALL:                                          ▐▌
 █ Enter a service name for glftpd. This name will be used as the service     ▐▌
 █ name mapped to the port in /etc/services, the name used in your (x)inetd   ▐▌
 █ settings, and the name of your config-file.                                ▐▌
 █ NOTE: If you (wish to) have multiple instances of glftpd on the same box,  ▐▌
 █ you *must* to change this.                                                 ▐▌
 █ Press <enter> for the default (glftpd)> glftpd                             ▐▌
 █                                                                            ▐▌
 █ *My note: If you see this error: glupdate .. FAILED!                       ▐▌
 █ Don't worry, unless you are doing an update.                               ▐▌
 █                                                                            ▐▌
 █ 5. COMPILING SOURCES & COPYING LIBS:                                       ▐▌
 █ modifying source (bin/sources/glconf.h) ... OK.                            ▐▌
 █                                                                            ▐▌
 █ 6. PORT AND SYSTEM SETUP:                                                  ▐▌
 █ Enter the port you would like glftpd to listen on [1337]: 33669            ▐▌
 █ Setting userfile permissions . . .                                         ▐▌
 █ Adding glftpd service to /etc/services (as glftpd) . .                     ▐▌
 █ Copying glftpd.conf to /jail/glftpd.conf . . .                             ▐▌
 █                                                                            ▐▌
 █ *My note: port '33669' should be changed to the port you want to use. For  ▐▌
 █ security please do not use standard port like 21 or use its default port.  ▐▌
 █                                                                            ▐▌
 █ Do you want to use [I]netd or [X]inetd? I                                  ▐▌
 █ I select 'I' as per our step 8 earlier my server is running inetd.         ▐▌
 █                                                                            ▐▌
 █ Do you wish to use European weeks? European weeks starts with a Monday.    ▐▌
 █ This is for glftpd's reset binary (see docs for more info) [Y/N]: Y        ▐▌
 █                                                                            ▐▌
 █ 7. SSL/TLS SETUP:                                                          ▐▌
 █ We will now create a certificate for SSL/TLS support. This step is         ▐▌
 █ required.                                                                  ▐▌
 █ Please specify location, inside /jail/glftpd, to install the cert          ▐▌
 █ (ftpd-dsa.pem) [/etc]: /etc                                                ▐▌
 █ Please specify a generic name for this certificate. This can be any name   ▐▌
 █ but should say something about the ftp server like the name for it perhaps ▐▌
 █ (press enter for glftpd): glftpdmewbie                                     ▐▌
 █ Please wait while creating certificate... (will take time!)                ▐▌
 █                                                                            ▐▌
 █ Note: from v2.02 it will generate a ECDSA cert; ftpd-ecdsa.pem             ▐▌
 █                                                                            ▐▌
 █ 8. STARTING GLFTPD:                                                        ▐▌
 █ Copying /etc/resolv.conf etc...                                            ▐▌
 █                                                                            ▐▌
 █ 9. FINISHED:                                                               ▐▌
 █ Congratulations, glFtpD has been installed. Scroll up and note any errors  ▐▌
 █ that needs fixing. ./installgl.debug contains a log of the installation    ▐▌
 █ process. To get your site running, you must edit /jail/glftpd.conf         ▐▌
 █ according to the instructions in /jail/glftpd/docs/glftpd.docs.            ▐▌
 █ For help, visit #glftpd on EFnet after you've read (not skimmed) the       ▐▌
 █ docs/faq.                                                                  ▐▌
 █                                                                            ▐▌
 █ INETD ERROR?:                                                              ▐▌
 █ `````````````                                                              ▐▌
 █ If you see an error similar to this OR can't login to your FTP (login -    ▐▌
 █ next section):                                                             ▐▌
 █ Restarting inetd . . . Failed! You must restart inetd before using glftpd. ▐▌
 █ To view if inetd is listed as running:                                     ▐▌
 █ ps -A                                                                      ▐▌
 █ find reply in list something like this: 1899 ? 00:00:00 inetd              ▐▌
 █ If it is running stop it:                                                  ▐▌
 █ killall -HUP inetd                                                         ▐▌
 █ or                                                                         ▐▌
 █ kill -HUP [PID of inetd] which in my reply above PID would be:             ▐▌
 █ kill -HUP 1899                                                             ▐▌
 █                                                                            ▐▌
 █ Then we need to edit the inetd.conf:                                       ▐▌
 █ (to read about inetd: man inetd.conf )                                     ▐▌
 █ pico /etc/inetd.conf                                                       ▐▌
 █                                                                            ▐▌
 █ If these lines aren't in the file add them at the bottom (mine weren't):   ▐▌
 █ #:OTHER: Other services                                                    ▐▌
 █ glftpd stream tcp nowait root /usr/sbin/tcpd /glftpd/bin/glftpd -l -o -i   ▐▌
 █                                                                            ▐▌
 █ Now start inetd:                                                           ▐▌
 █ /etc/init.d/openbsd-inetd start                                            ▐▌
 █                                                                            ▐▌
 █ *My note: After updating Debian version those lines in my inetd.conf now   ▐▌
 █ are like this:                                                             ▐▌
#:OTHER: Other services
#<off># netbios-ssn stream tcp nowait root /usr/sbin/tcpd /usr/sbin/smbd

glftpd stream tcp nowait root /usr/sbin/tcpd /jail/glftpd/bin/glftpd -l -o -i -r /jail/glftpd.conf -s/jail/glftpd/bin/bin/glstrings.bin -e

█ ▐▌ █ Done with the install. Now to start the server and set some perms etc. ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ STARTING GLFTPD SERVER: ▐▌ █ ``````````````````````` ▐▌ █ To start the server: ▐▌ █ /etc/init.d/openbsd-inetd start ▐▌ █ (to stop it: /etc/init.d/openbsd-inetd stop ) ▐▌ █ ▐▌ █ To have glFTPd run after rebooting the machine you'll need to either: ▐▌ █ Manually add it to the sysv-rc-conf list; shows what will be started on ▐▌ █ reboot: ▐▌ █ sysv-rc-conf ▐▌ █ To navigate use arrow key, use space key to toggle an item on [X] or off ▐▌ █ [ ] ▐▌ █ For glFTPd toggle on 2-5 for openbsd-inetd ▐▌ █ q to quit that window ▐▌ █ ▐▌ █ Or you can simply issue that with a cmd: ▐▌ █ sysv-rc-conf openbsd-inetd on ▐▌ █ Which will toggle on 2-5. ▐▌ █ To remove it from start up list: sysv-rc-conf openbsd-inetd off ▐▌ █ To view the list: sysv-rc-conf --list ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ SETTING GLFTPD PERMS: ▐▌ █ ````````````````````` ▐▌ █ Make sure all permissions are set correctly in 'jail/glftpd/bin': ▐▌ █ chmod -R 755 /jail/glftpd/bin ▐▌ █ chmod -R 755 /jail/glftpd/lib ▐▌ █ ▐▌ █ Incoming directory is world-wide-read-writeable and 'jail' is indeed ▐▌ █ jailed: ▐▌ █ chmod 777 /jail/glftpd/site/incoming ▐▌ █ chmod 770 /jail ▐▌ █ ▐▌ █ To set site back to correct perms if you need: ▐▌ █ find /jail/glftpd/site -type d -exec chmod 777 {} \; ▐▌ █ ▐▌ █ Note: All directories you want users to access through glFTPd should be ▐▌ █ 755, and incoming directories (users upload to) should be 777. So if for ▐▌ █ example you want users to be able to make directories in the directory ▐▌ █ 'site': ▐▌ █ chmod -R 777 /jail/glftpd/site ▐▌ █ (the '-R' means recursive; all directories in 'site' directory will be ▐▌ █ 777) ▐▌ █ ▐▌ █ To list your perms for 'site' or for 'jail': ▐▌ █ ls -ld /jail/glftpd/site/ ▐▌ █ ls -ld /jail/ ▐▌ █ exit ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ LOGIN TO YOUR FTP FIRST VIA SSH: ▐▌ █ ```````````````````````````````` ▐▌ █ ftp 127.0.0.1 33669 ▐▌ █ (replace port 33669 with the port you selected during install above) ▐▌ █ when prompted for a name: glftpd ▐▌ █ when prompted for a pass: glftpd ▐▌ █ If that went well - have a party :)! ▐▌ █ ▐▌ █ Now add yourself in this format, using *@* for 'yourself only': ▐▌ █ site adduser NAME PASS IDENT@IP.MASK ▐▌ █ for example: ▐▌ █ site adduser mewbie MyPaSsc45x6 *@* boo@12.234.*.* ▐▌ █ set your flags etc: ▐▌ █ site change mewbie flags +147ABCDEFGHI ▐▌ █ site change mewbie ratio 0 ▐▌ █ site change mewbie num_logins 3 ▐▌ █ site change mewbie max_sim_down 2 ▐▌ █ site grpadd MEW ▐▌ █ site grpchange MEW slots 9 ▐▌ █ site chgrp mewbie MEW ▐▌ █ ▐▌ █ For other users, always use their IDENT@IP.MASK, example: ▐▌ █ site adduser doggie wr00FFB0n3S arf@22.234.8.7 arf@22.234.8.9 ▐▌ █ or if they have a dynamic IP (one that changes often/not static IP) then ▐▌ █ you can add them with a wildcard/mask: ▐▌ █ site adduser doggie wr00FFB0n3S arf@22.234.*.* arf@22.235.*.* ▐▌ █ If for some reason they don't have an ident you can add: *@22.234.8.9 or ▐▌ █ *@22.234.8.* Only 2 wildcards allowed per IDENT@IP.MASK for security. In ▐▌ █ other words you can't (without changing glFTPd settings) and shouldn't ▐▌ █ add: *@22.234.*.* ▐▌ █ ▐▌ █ To log off the FTP and return to your shell: ▐▌ █ bye ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ THEN LOGIN TO YOUR FTP VIA AN FTP CLIENT: ▐▌ █ ````````````````````````````````````````` ▐▌ █ Now setup your server information in your FTP client tool, like FTPRush, ▐▌ █ and login with the new user you added for yourself (not glFTPd user). ▐▌ █ You'll need to set the protocol in your FTP tool to 'SSL FTP (AUTH SSL)'. ▐▌ █ Once you are done playing with your new server let's get to the fun parts: ▐▌ █ ▐▌ █ IF YOU COULDLN'T LOGIN: ▐▌ █ As per the docs: Add "glftpd: ALL" to /etc/hosts.allow (unless you didn't ▐▌ █ use tcpd in inetd.conf) ▐▌ █ ▐▌ █ So do this to see if that line is there: ▐▌ █ su ▐▌ █ cat /etc/hosts.allow ▐▌ █ If it's not, add it: ▐▌ █ pico /etc/hosts.allow ▐▌ █ Mine has this at the bottom: ▐▌ █ GLFTPD: ALL ▐▌ █ ▐▌ █ Still can't login; see above under the section 'INETD ERROR?' for inetd if ▐▌ █ you haven't done that. ▐▌ █ ▐▌ █ CRONTAB: ▐▌ █ ```````` ▐▌ █ This is to set it to do its thing automatically at a set time. To check ▐▌ █ if glftpd is already there: ▐▌ █ crontab -l ▐▌ █ Reply will be similar to: ▐▌ █ contrab: 0 0 * * * /jail/glftpd/bin/reset ▐▌ █ ▐▌ █ If not, open crontab and paste that line in: ▐▌ █ crontab -e ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ CREATING YOUR SECTIONS FOR SERVER: ▐▌ █ ``````````````````````````````````` ▐▌ █ MAKE DIRECTORIES FOR EACH SECTION: ▐▌ █ Read the docs to configure it for your own needs. I'm going to list what I ▐▌ █ did for my needs. ▐▌ █ Make directories for each section with their perms (name them as you like, ▐▌ █ MEW directory will be private (only users in group MEW will have access ▐▌ █ - later in the tutorial how): ▐▌ █ su ▐▌ █ mkdir -m 777 /jail/glftpd/site/ZIPS ▐▌ █ mkdir -m 777 /jail/glftpd/site/SFV ▐▌ █ mkdir -m 777 /jail/glftpd/site/M3U ▐▌ █ mkdir -m 777 /jail/glftpd/site/MEW ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ PREPARING FOR GLFTPD CONFIGURATIONS: ▐▌ █ ```````````````````````````````````` ▐▌ █ LINUX BEGINNER NOTES AND TIPS - for upcoming steps; not to do now: ▐▌ █ SYMBOLIC LINKS: ▐▌ █ 1. If you edit a file that is symbolically linked (symlink / like a ▐▌ █ Window's 'short cut') the original and the symlinked file/s will be ▐▌ █ edited. ▐▌ █ ▐▌ █ 2. If you want to delete/remove a symlink you can safely use the 'rm' ▐▌ █ cmd (remove). It won't delete the directory/file it is pointing to. It ▐▌ █ will only remove the symlink. *Be sure it is the symlink you remove and ▐▌ █ not the original file. ▐▌ █ ▐▌ █ 3. To check if a file, for example glftpd.conf, is symlinked and correctly ▐▌ █ linked (this will also show its perms), do: ▐▌ █ ls -la /etc/glftpd.conf ▐▌ █ Output should be: ▐▌ █ lrwxrwxrwx 1 root root 28 /etc/glftpd.conf -> /jail/glftpd/etc/glftpd.conf ▐▌ █ ▐▌ █ This means that /etc/glftpd.conf is a symlink to the original file ▐▌ █ /jail/glftpd/etc/glftpd.conf ▐▌ █ Wrong direction would be: ▐▌ █ lrwxrwxrwx 1 root root 16 /jail/glftpd/etc/glftpd.conf -> /etc/glftpd.conf ▐▌ █ ▐▌ █ And if it isn't linked output would be similar to: ▐▌ █ -rw-r--r-- 1 root root 9123 /jail/glftpd/etc/glftpd.conf ▐▌ █ ▐▌ █ 4. If symlinks are a problem because of /jail environment then do ▐▌ █ 'hard-links'; 'ln' instead of 'ln -s' but always try 'ln -s' first. ▐▌ █ ▐▌ █ DELETING: ▐▌ █ 5. Note: To delete/remove a file 'rm', you will NOT be asked first, like ▐▌ █ in Windows, 'Are you sure...'. For example to delete/remove a file: ▐▌ █ rm /path/to/file/here.txt ▐▌ █ To remove a directory containing other files and sub directories: ▐▌ █ rm TestDeleteMe/ -rf ▐▌ █ Note: Make it a habit to always use the '-rf' after the path to prevent ▐▌ █ accidentally deleting files and or paths if your fingers were to ▐▌ █ mistakenly hit the enter key before finished typing, i.e. rm -rf / ▐▌ █ would be disastrous :). ▐▌ █ ▐▌ █ EDITING: ▐▌ █ 6. Do NOT edit the files in Windows (unless you use a dos-unix editor) as ▐▌ █ some will be corrupted and most likely give this error when trying to run ▐▌ █ them: ▐▌ █ '/bin/bash^M: bad interpreter: No such file or directory'. ▐▌ █ You can fix a file that has been corrupted in this manner in your Linux ▐▌ █ box by using tofrodos: ▐▌ █ apt-get install tofrodos ▐▌ █ man tofrodos ▐▌ █ Then for example on a file named example.sh that has been corrupted in ▐▌ █ Windows: ▐▌ █ dos2unix example.sh ▐▌ █ ▐▌ █ 7. As per docs: When editing 'glFTPd files' use the 'Tab key' for spaces! ▐▌ █ If you want to use a 'space' in an argument, you need to use [:space:] ▐▌ █ instead. GlFTPd will convert it to ' '. ▐▌ █ ▐▌ █ 8. Changes to glftpd.conf can be done while server is running and do not ▐▌ █ require restarting the server. Simply log out then log back into the ▐▌ █ server to see the changes. ▐▌ █ ▐▌ █ ORDER OF SETTINGS: ▐▌ █ 9. Clients read the glftpd.conf from the bottom up. So the order of ▐▌ █ similar settings is important so that don't override each other. For a ▐▌ █ simple example to understand this - if you have in your glftpd.conf: ▐▌ █ Allow all except dogs in directory /site ▐▌ █ Allow all in directory /site/incoming ▐▌ █ ▐▌ █ With that setting, in that order, all including dogs will be allowed in ▐▌ █ directory /site ▐▌ █ The correct order would be to reverse those. Then dogs would not be ▐▌ █ allowed in directory /site ▐▌ █ ▐▌ █ SETTINGS: ▐▌ █ 10. When you see settings that 0 or 1: 0 = no (false), 1 = yes (true). ▐▌ █ ▐▌ █ 11. Any lines in the glftpd.conf that are preceded with: # ▐▌ █ are not used, they are 'commented out'. These are generally instructions, ▐▌ █ tips and possible settings to use. To enable a setting that is preceded ▐▌ █ with #; remove the #. For example a file has: ▐▌ █ # dir_name 1 none [:space:]_ ▐▌ █ To use that setting change it to: ▐▌ █ dir_name 1 none [:space:]_ ▐▌ █ ▐▌ █ TEXT SEARCH: ▐▌ █ 12. If you want to search for a key word or string on a file, without ▐▌ █ opening the file, use grep. For example, to find the word 'shutdown' on ▐▌ █ 'glftpd.conf' do this: ▐▌ █ grep shutdown /jail/glftpd/etc/glftpd.conf ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ OK, ENOUGH, LET'S BEGIN: ▐▌ █ ALWAYS make backups of your files you are going to edit, just in case (or ▐▌ █ keep notes on changes): ▐▌ █ cp /jail/glftpd.conf /jail/glftpd.conf.backup ▐▌ █ (or your file may be here: /jail/glftpd/glftpd.conf ) ▐▌ █ ▐▌ █ Then copy glftpd.conf to /jail/glftpd/etc/ - this copy will be the main ▐▌ █ glftpd.conf that we edit: ▐▌ █ cp /jail/glftpd.conf /jail/glftpd/etc/glftpd.conf ▐▌ █ Then remove (if you had it in this location) as we are going to make a ▐▌ █ symlink to it: ▐▌ █ rm /jail/glftpd.conf ▐▌ █ ▐▌ █ LINK THE FILE TO ETC AND JAIL: ▐▌ █ ln -s /jail/glftpd/etc/glftpd.conf /etc/glftpd.conf ▐▌ █ ln -s /jail/glftpd/etc/glftpd.conf /jail/glftpd.conf ▐▌ █ ▐▌ █ The reason we link that to the two locations - different clients will look ▐▌ █ for glftpd.conf in different locations. ▐▌ █ The reason for the link (instead of copying (cp) is when we edit the file ▐▌ █ all locations have the exact same glftpd.conf. ▐▌ █ ('ln -sf' option (not used here) is to force a link, for example if file ▐▌ █ exist) ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ SECURITY STEP: ▐▌ █ `````````````` ▐▌ █ mv /jail/glftpd/etc/ftpd-dsa.pem /jail/ftpd-dsa.pem ▐▌ █ rm /jail/glftpd/etc/ftpd-dsa.pem ▐▌ █ ▐▌ █ Or if your certificate is ftpd-ecdsa.pem: ▐▌ █ mv /jail/glftpd/etc/ftpd-ecdsa.pem /jail/ftpd-ecdsa.pem ▐▌ █ rm /jail/glftpd/etc/ftpd-ecdsa.pem ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ CONFIGURING GLFTPD: ▐▌ █ ``````````````````` ▐▌ █ NOTES: ▐▌ █ 1. Refer to the enclosed glftpd.conf-EXAMPLES and docs for all settings ▐▌ █ explained with examples given. ▐▌ █ ▐▌ █ 2. Find my complete glftpd.conf, as per this tutorial's example, HERE for ▐▌ █ your reference only. ▐▌ █ ▐▌ █ 1. This is what I did: ▐▌ █ pico /jail/glftpd/etc/glftpd.conf ▐▌ █ Top line change to reflect correct path of of your ftpd-dsa.pem: ▐▌ █ Mine had this: ▐▌ █ /jail/glftpd/etc/ftpd-dsa.pem ▐▌ █ I changed it to: ▐▌ █ /jail/ftpd-dsa.pem ▐▌ █ ▐▌ █ OR if you are using ftpd-ecdsa.pem change it to: ▐▌ █ #if you have rsa cert file ▐▌ █ #RSA_CERT_FILE /glftpd/ftpd-rsa.pem ▐▌ █ #if you have dsa cert file ▐▌ █ #DSA_CERT_FILE /jail/ftpd-dsa.pem ▐▌ █ CERT_FILE /jail/ftpd-ecdsa.pem ▐▌ █ ▐▌ █ 2. Fill in your correct site name, short name, email and root path, ▐▌ █ which would be this for my install: ▐▌ █ rootpath /jail/glftpd ▐▌ █ ▐▌ █ 3. Can SKIP this for now and come back to it later if you are going to ▐▌ █ make your own site messages, (section, 'CUSTOMIZING YOUR MESSAGES' further ▐▌ █ down) then add them to the glftpd.conf. For example: ▐▌ █ welcome_msg /ftp-data/misc/welcomefriends.msg =friends ▐▌ █ welcome_msg /ftp-data/misc/welcome.msg * ▐▌ █ goodbye_msg /ftp-data/misc/goodbye.msg * ▐▌ █ newsfile /ftp-data/misc/newsfile.friends =friends ▐▌ █ newsfile /ftp-data/misc/newsfile !=friends * ▐▌ █ banner /ftp-data/misc/banner ▐▌ █ ▐▌ █ 4. TLS settings for your server, details with more options on ▐▌ █ glftpd-2.04/docs/README.TLS: ▐▌ █ !* = no one / no ▐▌ █ * = everyone / yes ▐▌ █ !-dog * = except dog everyone else ok ▐▌ █ So then to force all users to secure mode only (TLS) use these settings: ▐▌ █ ▐▌ █ # TLS enforcements. ▐▌ █ userrejectsecure !* ▐▌ █ userrejectinsecure * ▐▌ █ denydiruncrypted * ▐▌ █ denydatauncrypted * ▐▌ █ ▐▌ █ This will: not reject secure login to users ▐▌ █ Will reject all insecure logins ▐▌ █ Will deny un-encrypted dir listing ▐▌ █ Will deny un-encrypted data transfer ▐▌ █ ▐▌ █ Your users then will need to adjust their FTP client settings to meet this ▐▌ █ enforcement. For example in FTPRush select Tools > Site Manager > Open the ▐▌ █ site > Connection > SSL> check the radio boxes for 'Encrypt data when ▐▌ █ listing', 'Encrypt data when transferring' and 'Enable SSL Transfer' for ▐▌ █ each site they are going to transfer from to your site. If not they will ▐▌ █ have an error in their FTP client stating: ▐▌ █ 522 You have to turn on secure data connection. ▐▌ █ ▐▌ █ 4. In the 'stat section' you need to add the directories you created ▐▌ █ earlier in your /site/incoming. This is what I have: ▐▌ █ # SECTION # KEYWORD DIRECTORY SEPARATE CREDITS ▐▌ █ ########################################################################## ▐▌ █ stat_section DEFAULT * yes ▐▌ █ stat_section ZIPS /site/ZIPS/* no ▐▌ █ stat_section SFV /site/SFV/* no ▐▌ █ stat_section M3U /site/M3U/* no ▐▌ █ stat_section MEW /site/MEW/* no ▐▌ █ stat_section incoming /site/incoming/* no ▐▌ █ ▐▌ █ Below that is the 'rights sections'. Again refer to glftpd.conf-EXAMPLES ▐▌ █ for that easily explained. And set your how you like. ▐▌ █ ▐▌ █ 5. Further down you'll see: ▐▌ █ free_space 20 (this means how much free space is required to grant upload ▐▌ █ permision) ▐▌ █ max_users 15 5 (How many user may be logged in at the same time) ▐▌ █ total_users 300 (Maximum accounts amount on server) ▐▌ █ ▐▌ █ Since mine is a small private site, I have changed it to: ▐▌ █ free_space 20 ▐▌ █ max_users 15 5 ▐▌ █ total_users 20 ▐▌ █ ▐▌ █ 6. Dupe section: I don't want dupe checking in two of my directories (MEW ▐▌ █ and incoming) so I add this: ▐▌ █ dupe_check 7 no ▐▌ █ nodupecheck /site/MEW/* ▐▌ █ nodupecheck /site/incoming/* ▐▌ █ If you don't want dupe checking entire site then it would be: ▐▌ █ /site/* * ▐▌ █ Or to exclude a user or group, use this: !-username grp !=grpname ▐▌ █ (dupe checking prevents users from uploading a file of the 'same name' ▐▌ █ that is on the site, even if it's in a different directory) ▐▌ █ ▐▌ █ 7. In the '<cap 1st letter>' section I want to allow directory names to ▐▌ █ begin with a lower case and not have glftpd change it to an upper case so ▐▌ █ I change: ▐▌ █ dir_names 1 none [:space:]_ ▐▌ █ To: ▐▌ █ dir_names 0 none [:space:]_ ▐▌ █ ▐▌ █ Note: [:space:]_ that means that if a file or directory has a space in its ▐▌ █ name, it will replace the space with _ . Basically put; Linux doesn't ▐▌ █ like spaces. ▐▌ █ ▐▌ █ 8. In the Private Groups sections, I add my group MEW (that I added ▐▌ █ earlier on in this tutorial via site cmd) like this: ▐▌ █ privgroup STAFF My[:space:]Private[:space:]Group ▐▌ █ privgroup MEW MEW ▐▌ █ ▐▌ █ Below that in 'PRIVPATH' sections I've added the directory MEW with ▐▌ █ settings that only users in group MEW will be able to have access to it. ▐▌ █ Further more I have only allowed the groups friends to have access to the ▐▌ █ directory incoming (remember my note above about the order of dogs...the ▐▌ █ order you add this is important). I've added it like this: ▐▌ █ #privpath /site/privatedir 1 =STAFF ▐▌ █ privpath /site/MEW 1 =MEW ▐▌ █ privpath /site/incoming * ▐▌ █ privpath /site !=friends * ▐▌ █ ▐▌ █ 9. In my glftpd.conf in the section 'CUSTOM SITE COMMANDS' section I have ▐▌ █ added the other scripts I'm using. If you don't have/ aren't using these ▐▌ █ scripts then do not add them. You can add them later once they are ▐▌ █ installed correctly. For details about each script's installing procedure ▐▌ █ see below under section 'INSTALLING EXTRA SCRIPTS'. So for now I would ▐▌ █ just leave it as is and work on the scripts after you are done with this ▐▌ █ file. In any case my section looks like this: ▐▌ █ site_cmd RULES TEXT /ftp-data/misc/site.rules ▐▌ █ site_cmd LOCATE EXEC /bin/locate.sh ▐▌ █ site_cmd NFO EXEC /bin/sitenfo.sh ▐▌ █ site_cmd ZIPCHK EXEC /bin/sitezipchk.sh ▐▌ █ site_cmd ZIPLIST EXEC /bin/siteziplist.sh ▐▌ █ site_cmd NFOVIEW EXEC /bin/nfoview.sh ▐▌ █ site_cmd RARTEST EXEC /bin/rartest.sh ▐▌ █ site_cmd RARDTL EXEC /bin/rardtl.sh ▐▌ █ site_cmd INVITE EXEC /bin/invite.sh ▐▌ █ ▐▌ █ 10. Now I need to let glftpd know who is allowed to use these scripts ▐▌ █ since I don't allow group friends to use all of them. I have added: ▐▌ █ custom-rules !8 !=friends * ▐▌ █ custom-locate !8 !=friends * ▐▌ █ custom-nfo !8 * ▐▌ █ custom-zipchk !8 * ▐▌ █ custom-ziplist !8 * ▐▌ █ custom-nfoview !8 * ▐▌ █ custom-rartest !8 * ▐▌ █ custom-rardtl !8 * ▐▌ █ custom-invite !8 * ▐▌ █ ▐▌ █ I've also changed these settings to not allow group friends acces to these ▐▌ █ cmds, for example: ▐▌ █ custom-rules !8 !=friends * ▐▌ █ custom-locate !8 !=friends * ▐▌ █ ▐▌ █ -delownip !8 !=friends * ▐▌ █ -dirs !8 !=friends * ▐▌ █ ▐▌ █ To assign master(s) of the site; enable editing of anyone's flags ▐▌ █ including all siteops via FTP, add master & their login name, for example: ▐▌ █ master mewbie DoGgie ▐▌ █ ▐▌ █ 11. Add to bottom of file the passive port range you want your site to use ▐▌ █ and your site's IP followed by 1. ▐▌ █ For example add this: ▐▌ █ pasv_ports 10000-11000 ▐▌ █ pasv_addr 74.125.45.100 1 ▐▌ █ ▐▌ █ 12. To allow FXP (see docs for various settings): ▐▌ █ allow_fxp yes yes yes * ▐▌ █ or to stop bot from announcing each FXP transfer out: ▐▌ █ allow_fxp yes yes no * ▐▌ █ ▐▌ █ If you looked at my sample glftpd.conf you'll see other settings below ▐▌ █ 'allow_fxp' - all are for 'pzs-ng script'. You do not need any of these ▐▌ █ lines if you aren't going to install pzs-ng script. ▐▌ █ ▐▌ █ Done configuring glftpd.conf. ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ USERS VIEW THEIR HOME DIRECTORY ONLY: ▐▌ █ ````````````````````````````````````` ▐▌ █ Now I want to set the home directory of friends to view /incoming/ only. ▐▌ █ Otherwise they will view /site/incoming/ . Though they will be denied if ▐▌ █ they try to enter /site/ directory (as per my settings in glftpd.conf) I ▐▌ █ don't want them to see it. Issue this cmd via site (on the server, not ▐▌ █ SSH): ▐▌ █ site change =friends startup_dir /incoming ▐▌ █ You could do this for a user as well: ▐▌ █ site change username homedir /site/ ▐▌ █ Of course you will need to add username in glftpd.conf to the correct ▐▌ █ perms. ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ CUSTOMIZING YOUR MESSAGES: ▐▌ █ `````````````````````````` ▐▌ █ WELCOME MESSAGE AND NEWS: ▐▌ █ I have two different welcome messages and news message for different users ▐▌ █ on the site. ▐▌ █ One would be for all users on the site except the group friends that would ▐▌ █ have a different one. ▐▌ █ To do this - make copy of the relevant files, name them appropriately, ▐▌ █ edit them how you like, and add them to glftpd.conf as I've shown above ▐▌ █ in 'CONFIGURING GLFTPD'. ▐▌ █ I did edit these files in Windows (bad habit) using Notepad++ then ▐▌ █ uploaded them- they were fine. If you do upload files that exist; delete ▐▌ █ the file first on server then upload - don't overwrite file by uploading ▐▌ █ as many times files will merge and not truly be over-written and you'll ▐▌ █ have a corrupted and or incorrect file(s). ▐▌ █ ▐▌ █ You'll find the files in the package here: glftpd-LNX_2.01\ftp-data\ ▐▌ █ Welcome message and news, what the users see when they first login, are ▐▌ █ here: ▐▌ █ glftpd-LNX_2.01\ftp-data\text\onel.head ▐▌ █ glftpd-LNX_2.01\ftp-data\text\onel.foot ▐▌ █ glftpd-LNX_2.01\ftp-data\misc\welcome.msg ▐▌ █ glftpd-LNX_2.01\ftp-data\misc\newsfile ▐▌ █ ▐▌ █ On the server there are here: ▐▌ █ /jail/glftpd/ftp-data/text/onel.head ▐▌ █ /jail/glftpd/ftp-data/text/onel.foot ▐▌ █ /jail/glftpd/ftp-data/misc/welcome.msg ▐▌ █ /jail/glftpd/ftp-data/misc/newsfile ▐▌ █ ▐▌ █ 1. Make a copy of all files you want to edit and rename to your own name. ▐▌ █ For example: ▐▌ █ cd /jail/glftpd/ftp-data/ ▐▌ █ cp /text/onel.head /text/onelcustom.head ▐▌ █ cp /text/onel.foot /text/onelcustom.foot ▐▌ █ cp /misc/welcome.msg /misc/welcomecustom.msg ▐▌ █ cp /misc/newsfile /misc/newsfilecustom ▐▌ █ ▐▌ █ 2. Put your own welcome msg and design in your new onelcustom.head: ▐▌ █ pico /jail/glftpd/ftp-data/text/onelcustom.head ▐▌ █ ▐▌ █ 3. Same for your new onelcustom.foot and newsfilecustom. ▐▌ █ ▐▌ █ 4. Put your new names; onelcustom.head and onelcustom.foot in your new ▐▌ █ welcomecustom.msg file: ▐▌ █ pico /jail/glftpd/ftp-data/misc/welcomecustom.msg ▐▌ █ Edit to the correct path/name to those in your new onelcustom.head. For ▐▌ █ example welcomecustom.msg has this: ▐▌ █ %!/ftp-data/text/onel.head ▐▌ █ %ONEL ▐▌ █ %!/ftp-data/text/onel.foot ▐▌ █ ▐▌ █ Change to: ▐▌ █ %!/ftp-data/text/onelcustom.head ▐▌ █ %ONEL ▐▌ █ %!/ftp-data/text/onelcustom.foot ▐▌ █ ▐▌ █ pico /jail/glftpd/ftp-data/misc/newsfilecustom ▐▌ █ Enter your own news in. ▐▌ █ ▐▌ █ 5. Upload those to the server (if your editing wasn't done on the server). ▐▌ █ ▐▌ █ 6. You could add yourself on the site as a new user that belongs only to ▐▌ █ group friends. Then login as that user to view just how they would view ▐▌ █ the site. ▐▌ █ ▐▌ █ 7. Then add your new files to your glftpd.conf, with settings, as shown ▐▌ █ above in 'CONFIGURING GLFTPD'. ▐▌ █ Note: If the file 'welcomecustom.msg' doesn't exist it won't show any ▐▌ █ welcome message or give users an error. It will though still show the ▐▌ █ newsfile. ▐▌ █ ▐▌ █ SITE HELP: ▐▌ █ When users issue the cmd: site help ▐▌ █ they will receive a list of site commands. If you have other site ▐▌ █ commands you want to list here, for example the extra scripts you have ▐▌ █ installed: ▐▌ █ pico /jail/glftpd/ftp-data/help/site.help.all ▐▌ █ Add your new site cmds. ▐▌ █ At the end of this file do not hit enter key, or 'site help' will have a ▐▌ █ gap at the end of your new site cmds. ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ INSTALLING EXTRA SCRIPTS: ▐▌ █ ````````````````````````` ▐▌ █ Optional: As per my glftpd.conf in the section 'CUSTOM SITE COMMANDS' I ▐▌ █ have extra scripts (*.sh) installed and enabled. You'll find four of these ▐▌ █ scripts in the package (tar.gz) glftpd*\bin\ or on your server here: ▐▌ █ /jail/glftpd/bin/ ▐▌ █ locate.sh : Enables users to locate files on the server ▐▌ █ sitenfo.sh : View a nfo file that is 'inside' of a zip ▐▌ █ sitezipchk.sh : Checks the integrity of a zip file ▐▌ █ siteziplist.sh : Detailed list of the files in a .zip file ▐▌ █ Note: You'll also see dated.sh - to use this see my section below 'DATED ▐▌ █ DIRECTORIES'. ▐▌ █ ▐▌ █ Very easy to use these: ▐▌ █ su ▐▌ █ To see if the scripts are already in the needed directory: ▐▌ █ ls /jail/glftpd/bin/ ▐▌ █ If you don't see the script there then, for example sitenfo.sh: ▐▌ █ cp /home/user/glftpd/bin/sitenfo.sh /jail/glftpd/bin/sitenfo.sh ▐▌ █ ▐▌ █ Scripts will either have their instructions on them or a doc included with ▐▌ █ it. ▐▌ █ If you are planning to install all of these scripts then let's copy all the▐▌ █ binaries needed: find, echo, cut, bash, unzip, rar, unrar, and cat ▐▌ █ If they are installed you will find most of them in /bin/ To view if you ▐▌ █ have them: ▐▌ █ ls /bin ▐▌ █ To view if you have the needed binaries already in the script's correct ▐▌ █ path: ▐▌ █ ls /jail/glftpd/bin/ ▐▌ █ Those that aren't there copy them over. For example I needed echo, rar, ▐▌ █ and unrar: ▐▌ █ cp /bin/echo /jail/glftpd/bin/echo ▐▌ █ rar and unrar aren't located in bin. To find the location: ▐▌ █ which rar ▐▌ █ which unrar ▐▌ █ (If curious about its installation: dpkg -L unrar && dpkg -L rar) ▐▌ █ ▐▌ █ Copy them over from the path it replied: ▐▌ █ cp /usr/bin/unrar /jail/glftpd/bin/unrar ▐▌ █ cp /usr/bin/rar /jail/glftpd/bin/rar ▐▌ █ Then I set the perms on the binaries I copied over: ▐▌ █ chmod 755 /jail/glftpd/bin/echo ▐▌ █ chmod 755 /jail/glftpd/bin/unrar ▐▌ █ chmod 755 /jail/glftpd/bin/rar ▐▌ █ Set the perms on the rest of the binaries if they aren't already 755. ▐▌ █ ▐▌ █ SITENFO.SH ▐▌ █ To view the script and to see if it has instructions on it: ▐▌ █ cat /jail/glftpd/bin/sitenfo.sh ▐▌ █ and you'll see near the top: ▐▌ █ #INSTRUCTIONS ▐▌ █ #Add the following lines to your glftpd.conf: ▐▌ █ # site_cmd NFO EXEC /bin/sitenfo.sh ▐▌ █ # custom-nfo !8 * ▐▌ █ #Make sure unzip and echo are in your binary path that is ▐▌ █ #specified below and they are chmod 755 ▐▌ █ ▐▌ █ As per the instructions; set perms on it: ▐▌ █ chmod 755 /jail/glftpd/bin/sitenfo.sh ▐▌ █ ▐▌ █ Then add it to your glftpd.conf: ▐▌ █ pico /jail/glftpd/etc/glftpd.conf ▐▌ █ Add this line with the other site_cmds: ▐▌ █ site_cmd NFO EXEC /bin/sitenfo.sh ▐▌ █ ▐▌ █ Then add the line with the other customs that will state who is allowed ▐▌ █ to use sitenfo.sh: ▐▌ █ custom-nfo !8 * ▐▌ █ ▐▌ █ LOCATE.SH ▐▌ █ Do same method for the other scripts. For the other scripts I did: ▐▌ █ cat /jail/glftpd/bin/locate.sh ▐▌ █ chmod 666 /jail/glftpd/dev/null ▐▌ █ btw this was already 666, didn't need to do it. ▐▌ █ pico /jail/glftpd/bin/locate.sh ▐▌ █ edit 'sitepath=/site' 'pathsize=5' if your installation is different. ▐▌ █ I didn't need to edit this file. ▐▌ █ ▐▌ █ ZIPCHK.SH ▐▌ █ cat /jail/glftpd/bin/sitezipchk.sh ▐▌ █ I did nothing further ▐▌ █ ▐▌ █ SITEZIPLIST.SH ▐▌ █ cat /jail/glftpd/bin/siteziplist.sh ▐▌ █ pico /jail/glftpd/etc/glftpd.conf ▐▌ █ Add this line with the other site_cmds: ▐▌ █ site_cmd ZIPLIST EXEC /bin/siteziplist.sh ▐▌ █ custom-ziplist !8 * ▐▌ █ ▐▌ █ OTHER SCRIPTS ▐▌ █ NFOVIEW.SH ▐▌ █ Other scripts that I have on my glftpd.conf that are not included with ▐▌ █ glFTPd are enabled in a similar method, for example: ▐▌ █ 1. nfoview.sh - view a text file in a directory ▐▌ █ Exit root if you are still: exit ▐▌ █ wget http://archive.glftpd.com/scripts/psxc/nfoview_v0.1.tgz ▐▌ █ tar -zxvf nfoview_v0.1.tgz ▐▌ █ See if I need to edit anything and find the lines to add to glftpd.conf: ▐▌ █ pico nfoview.sh ▐▌ █ Change site name: SITE="PSXC" and what types of files you want supported ▐▌ █ below that. ▐▌ █ su ▐▌ █ cp nfoview.sh /jail/glftpd/bin/nfoview.sh ▐▌ █ chmod 755 /jail/glftpd/bin/nfoview.sh ▐▌ █ pico /jail/glftpd/etc/glftpd.conf ▐▌ █ Add script's lines: ▐▌ █ site_cmd NFOVIEW EXEC /bin/nfoview.sh ▐▌ █ custom-nfoview !8 * ▐▌ █ ▐▌ █ exit ▐▌ █ ▐▌ █ INVITE.SH ▐▌ █ 2. invite.sh- users invite via site cmd to an IRC channel ▐▌ █ This script is an extra script included in 'pzs-ng (Project Zipscript - ▐▌ █ Next Generation)'. This is a wonderful 'zip script package' that comes ▐▌ █ with many nice extras. You don't need to use the one from pzs-ng, there ▐▌ █ are other invite scripts out there. Since I am using pzs-ng then I used ▐▌ █ the invite.sh included. You'll find it in the package HERE: ▐▌ █ project-zs-ng_r2500-v1.2.0/sitebot/extra/invite.sh ▐▌ █ This script will be executed by glftpd - not the sitebot/eggdrop. Bots ▐▌ █ only announce it, in the style set out by the 'theme' used. ▐▌ █ The instructions how to use invite.sh is included in its README: ▐▌ █ cat /home/project-zs-ng_r2500-v1.2.0/sitebot/README ▐▌ █ Add the following to glftpd.conf: ▐▌ █ site_cmd INVITE EXEC /bin/invite.sh ▐▌ █ custom-invite !8 * ▐▌ █ ▐▌ █ For instructions how to edit the invite IRC output on invite, read my ▐▌ █ 'PZS-NG ZIP SCRIPT' tutorial HERE. ▐▌ █ ▐▌ █ PZS-NG ZIP SCRIPT ▐▌ █ 3. For installing 'PZS-NG ZIP SCRIPT' I have made a separate tutorial for ▐▌ █ it HERE. ▐▌ █ ▐▌ █ MORE SCRIPTS ▐▌ █ 4. For links to others and a few scripts that I made; view section ▐▌ █ on left menu 'FTP SERVERS - LINUX & WIN / GLFTPD - SCRIPTS MINE'. ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ UNDUPE FILES VIA SSH: ▐▌ █ ````````````````````` ▐▌ █ If you would like to have the ability to undupe files via SSH (normally ▐▌ █ done via server: site updupe file) then you'll need to compile it first: ▐▌ █ su ▐▌ █ cd /jail/glftpd/bin/sources;gcc -o /jail/glftpd/bin/undupe undupe.c ▐▌ █ If it compiling was successful it won't have a reply. To view if it ▐▌ █ compiled the 'undupe' file: ▐▌ █ ls /jail/glftpd/bin/undupe ▐▌ █ If the reply is this, then it worked: /jail/glftpd/bin/undupe ▐▌ █ chmod +x /jail/glftpd/bin/undupe ▐▌ █ (chmod +x = chmod 755) ▐▌ █ Now try to undupe a file from your shell cmd, for example: ▐▌ █ /jail/glftpd/bin/undupe -f testundupe.r00 ▐▌ █ Reply will be: ▐▌ █ Trying to clear testundupe.r00 ▐▌ █ Dupe! Clearing!! ▐▌ █ ▐▌ █ exit ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ DATED DIRECTORIES AUTOMATICALLY MADE: ▐▌ █ ````````````````````````````````````` ▐▌ █ If you would like to have glftpd automatically make new 'dated' ▐▌ █ directories at midnight - names according to the day and the month; use ▐▌ █ this. The name would be for example 0106 which would be January 6. ▐▌ █ Furthermore it can prevent uploads to the previous days' directories - ▐▌ █ users can upload only to today's date. This can be very useful to use with ▐▌ █ students, staff, etc for projects that are due on a certain date, files ▐▌ █ that are updated regularly and you want them sorted by the date, ▐▌ █ photograph album sorting, a musician to see how they developed over time, ▐▌ █ etc. It will also make shortcuts (symlinks) to always point correctly to ▐▌ █ today's and yesterday's dated directories for easier navigating. ▐▌ █ ▐▌ █ In glftpd_faq.html: ▐▌ █ Q) How do I make dated directories automatically? ▐▌ █ A) Crontab /glftpd/bin/dated.sh to run at or right after midnight. ▐▌ █ ▐▌ █ Okay so let's add it to the crontab so dated.sh runs automatically at ▐▌ █ midnight. Same method when we added glftpd to crontab: ▐▌ █ su ▐▌ █ crontab -e ▐▌ █ Paste in this line at the bottom: ▐▌ █ 0 0 * * * /jail/glftpd/bin/dated.sh ▐▌ █ ▐▌ █ So at this point my complete crontab is: ▐▌ █ 0 0 * * * /jail/glftpd/bin/reset -e -r /jail/glftpd.conf ▐▌ █ 0 0 * * * /jail/glftpd/bin/dated.sh ▐▌ █ ▐▌ █ *My note only: contrab also list these, which are for PZSNG ZIP SCRIPT ▐▌ █ 59 23 * * * chroot /glftpd /bin/cleanup >/dev/null 2>&1 ▐▌ █ 29 4 * * * chroot /glftpd /bin/datacleaner >/dev/null 2>&1 ▐▌ █ ▐▌ █ Let's customize where it makes the dated directories and symlinks to them. ▐▌ █ To see if the script is already in the needed directory: ▐▌ █ ls /jail/glftpd/bin/ ▐▌ █ If you don't see dated.sh in that list then copy it over: ▐▌ █ cp /home/user/glftpd/bin/dated.sh /jail/glftpd/bin/dated.sh ▐▌ █ chmod 755 /jail/glftpd/bin/dated.sh ▐▌ █ pico /jail/glftpd/bin/dated.sh ▐▌ █ Has this: ▐▌ █ #!/bin/bash ▐▌ █ # simple script to create dated dirs ▐▌ █ # run this script as root. change paths if you're not using standard. ▐▌ █ ▐▌ █ date=`date +%m%d` ▐▌ █ #date2=`date --date '1 days ago' +%m%d` # this is just an example ▐▌ █ ▐▌ █ # the following will make sure people can't upload to old dated dirs ▐▌ █ chmod o-w /glftpd/site/incoming/* ▐▌ █ ▐▌ █ # this will create a new dated dir ▐▌ █ mkdir /glftpd/site/incoming/$date ▐▌ █ chmod 777 /glftpd/site/incoming/$date ▐▌ █ ▐▌ █ # This will create a 'today' link to today's dated directory ▐▌ █ cd /glftpd/site ▐▌ █ rm today ▐▌ █ ln -s ./incoming/$date today ▐▌ █ ▐▌ █ Change to (note the # is removed before date2), adding the paths (that ▐▌ █ are already in your glftpd.conf of course) where you want to have the ▐▌ █ dated directories made: ▐▌ █ #!/bin/bash ▐▌ █ # simple script to create dated dirs ▐▌ █ # run this script as root. change paths if you're not using standard. ▐▌ █ ▐▌ █ date=`date +%m%d` ▐▌ █ date2=`date --date '1 days ago' +%m%d` # this is just an example ▐▌ █ ▐▌ █ # the following will make sure people can't upload to old dated dirs ▐▌ █ chmod o-w /jail/glftpd/site/ZIPS/* ▐▌ █ ▐▌ █ # this will create a new dated dir ▐▌ █ mkdir /jail/glftpd/site/ZIPS/$date ▐▌ █ chmod 777 /jail/glftpd/site/ZIPS/$date ▐▌ █ ▐▌ █ # This will create a 'today' link to today's dated directory ▐▌ █ cd /jail/glftpd/site ▐▌ █ rm ZIPS-Today ▐▌ █ ln -s ./ZIPS/$date ZIPS-Today ▐▌ █ ▐▌ █ cd /jail/glftpd/site ▐▌ █ rm ZIPS-Yesterday ▐▌ █ ln -s ./ZIPS/$date2 ZIPS-Yesterday ▐▌ █ ▐▌ █ chmod o-w /jail/glftpd/site/M3U/* ▐▌ █ ▐▌ █ mkdir /jail/glftpd/site/M3U/$date ▐▌ █ chmod 777 /jail/glftpd/site/M3U/$date ▐▌ █ ▐▌ █ You don't need to add this to glftpd.conf as it will run from crontab ▐▌ █ every midnight now. ▐▌ █ You can test it right now by running dated.sh: ▐▌ █ /jail/glftpd/bin/./dated.sh ▐▌ █ That will make a directory in the paths you specified that is named after ▐▌ █ the date of today and create your symlinks. ▐▌ █ The first time you run the script it might reply with an error similar to ▐▌ █ (as there isn't the correct directories 'yet' to remove): ▐▌ █ chmod: cannot access `/jail/glftpd/site/0DAY/*': No such file or directory ▐▌ █ rm: cannot remove `0DAY-Today': No such file or directory ▐▌ █ rm: cannot remove `0DAY-Yesterday': No such file or directory ▐▌ █ ▐▌ █ Note: If you want users to still be able to upload to previous dates then ▐▌ █ comment out dated.sh chmod line. It has this: ▐▌ █ chmod o-w /jail/glftpd/site/ZIPS/* ▐▌ █ Change to: ▐▌ █ # chmod o-w /jail/glftpd/site/ZIPS/* ▐▌ █ ▐▌ █ Then chmod the directories it has already made: ▐▌ █ chmod 777 /jail/glftpd/site/ZIPS/0909/ ▐▌ █ exit ▐▌ █ ▐▌ █ WE ARE DONE :) ! ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ GLFTPD LOGS: ▐▌ █ ``````````` ▐▌ █ To handle all of GLFTPD logs view my tutorial HERE. ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ DENY .NFO & .DIZ UPLOAD IN ZIP DIRS & FORCE .SFV UPLOAD BEFORE .RARS: ▐▌ █ ````````````````````````````````````````````````````````````````````` ▐▌ █ You shouldn't allow *.nfo files to be uploaded in designated zip ▐▌ █ directories. The zip script should be the one to extract the .nfo from ▐▌ █ the zip file. This ensures that the directory contains the correct .nfo ▐▌ █ and if there isn't an .nfo file in a zip it will create a sym link ▐▌ █ (no-nfo). To enable this feature: ▐▌ █ su ▐▌ █ pico /jail/glftpd/etc/glftpd.conf ▐▌ █ Has this: ▐▌ █ #pre_check /bin/dupescript ▐▌ █ Change to, changing the path to location to deny nfo upload: ▐▌ █ pre_check /bin/dupescript /site/ZIP/* ▐▌ █ ▐▌ █ You need binary grep with perm 755 in your gl bin: ▐▌ █ ls -al /jail/glftpd/bin/grep ▐▌ █ If it isn't there copy it over and set the perms: ▐▌ █ which grep ▐▌ █ cp /bin/grep /jail/glftpd/bin/grep ▐▌ █ chmod 755 /jail/glftpd/bin/grep ▐▌ █ Check that your /glftpd/dev/null is chmod 666 (crw-rw-rw-): ▐▌ █ ls -al /jail/glftpd/dev/null ▐▌ █ ▐▌ █ Edit dupescript (denies nfo & diz): ▐▌ █ pico /jail/glftpd/bin/dupescript ▐▌ █ Has this: ▐▌ #!/bin/sh # $1 = Name of file. # $2 = Actual path the file is stored in # $PWD = Current Path. # EXIT codes.. # 0 - Good: # 2 - Bad: exit 0 #Remove ABOVE LINE to enable script. Know WTF you're doing before doing so! #Be sure your /glftpd/dev/null is chmod 666. case "$1" in *.[rR][aA][rR]|*.[rRsS0123456789][0123456789][0123456789]) # Be sure 'grep' is in /glftpd/bin ! if ls "$2" | grep -i sfv > /dev/null ; then exit 0 else echo -e "You must upload .sfv first!\n" exit 2 fi ;; #Deny NFO's and .DIZ files so they can't be uploaded. # *.[nN][fF][oO]) # exit 2; # ;; # *.[dD][iI][zZ]) # exit 2; # ;; *) # If you want to use echo and then exit with 0, you have to put "#0" # at the beginning of the string. Example: # echo -e "#0Filename passed dupescript, opening connection.\r" exit 0 ;; esac █ ▐▌ █ Change to this; removing line 'exit 0' and uncomment Deny directives: ▐▌ #!/bin/sh # $1 = Name of file. # $2 = Actual path the file is stored in # $PWD = Current Path. # EXIT codes.. # 0 - Good: # 2 - Bad: #Remove ABOVE LINE to enable script. Know WTF you're doing before doing so! #Be sure your /glftpd/dev/null is chmod 666. case "$1" in *.[rR][aA][rR]|*.[rRsS0123456789][0123456789][0123456789]) # Be sure 'grep' is in /glftpd/bin ! if ls "$2" | grep -i sfv > /dev/null ; then exit 0 else echo -e "You must upload .sfv first!\n" exit 2 fi ;; #Deny NFO's and .DIZ files so they can't be uploaded. *.[nN][fF][oO]) exit 2; ;; *.[dD][iI][zZ]) exit 2; ;; *) # If you want to use echo and then exit with 0, you have to put "#0" # at the beginning of the string. Example: # echo -e "#0Filename passed dupescript, opening connection.\r" exit 0 ;; esac █ Test - try to upload an .nfo file to your deny path. Try to upload a .rar ▐▌ █ file before an .sfv file has been uploaded. Done. ▐▌ █ exit ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ MISC NOTES: ▐▌ █ ``````````` ▐▌ █ 1. The logs are here: /jail/glftpd/ftp-data/logs/ ▐▌ █ ▐▌ █ 2. To view error.log for example: ▐▌ █ cat /jail/glftpd/ftp-data/logs/error.log ▐▌ █ ▐▌ █ 3. If you find on your error logs: ▐▌ █ "WARNING : glftpd was terminated from outside by other process" ▐▌ █ Not to worry as that means a user logged in with a '!' before their name ▐▌ █ to kill a ghost connection they had. ▐▌ █ If logs have this: ▐▌ █ Panic: SSL_ERROR_SSL in tls_read()! ▐▌ █ Panic: SSL_ERROR_SSL in tls_write()! ▐▌ █ Not to panic as I'm still trying to solve what that means :p ▐▌ █ ▐▌ █ To count how many instances of WARNING there are in error.log: ▐▌ █ grep WARNING /jail/glftpd/ftp-data/logs/error.log | wc -l ▐▌ █ ▐▌ █ 4. If for example you get an error on a file and it states 'line 135', to ▐▌ █ view line 135: ▐▌ █ sed -n 135p myfile.sh ▐▌ █ ▐▌ █ 5. To view out who owns jail: ▐▌ █ ls -l / | grep jail | cut -d ' ' -f 5 ▐▌ █ My output: root ▐▌ █ To view which group jail is in: ▐▌ █ ls -l / | grep jail | cut -d ' ' -f 6 ▐▌ █ My output: mew (default is glftpd) ▐▌ █ Or you could: ▐▌ █ ls -l / | grep jail ▐▌ █ My output: ▐▌ █ drwxrwx--- 4 root bbs 4096 Mar 4 11:04 jail ▐▌ █ ↑ ↑ ↑ ▐▌ █ owner / UID GID / group directory ▐▌ █ ▐▌ █ 6. To remove a directory named 'Test.Folder' via a site cmd, you must be ▐▌ █ in the parent directory of it: ▐▌ █ site wipe Test.Folder ▐▌ █ If it has other directories in it then: ▐▌ █ site wipe -r Test.Folder ▐▌ █ ▐▌ █ 7. States space used/free: df -h ▐▌ █ States space used/free with a more technical list: df -k ▐▌ █ States size in that dir only: du -h -s /jail/glftpd/site ▐▌ █ States size in that path with list of the file sizes: ▐▌ █ du -h /jail/glftpd/site ▐▌ █ (If you have mounted another area to /jail/glftpd/site it will not list ▐▌ █ those files or directories in the last two cmds (additional scripting is ▐▌ █ needed for that). ▐▌ █ ▐▌ █ 8. If for some crazy reason you want to link to an area on the server ▐▌ █ outside of jail symlinks will not work. You will need to do 'mount'. For a ▐▌ █ full description of how - read my APACHE NIX tutorial HERE, under the ▐▌ █ section 'JAIL NOTE:'. This is NOT recommended; security issue and defeats ▐▌ █ the purpose of jail. ▐▌ █ ▐▌ █ 9. glftpd.docs has list of all the site commands under the section ▐▌ █ 'II. Complete list of site commands' and all the flags available under the ▐▌ █ section 'Flags available'. I've compiled a complete list HERE for quick ▐▌ █ reference. ▐▌ █ ▐▌ █ //---------------------------------------------------------------------- ▐▌ █ ▐▌ █ If you find mistakes, have suggestions, and or questions please post at ▐▌ █ mewbies forum HERE - thank you. ▐▌ █ ▐▌ █ Last update on 05 Mar '14 ▐▌ █ ▐▌ █▌ █▌ █▌ - mewbies.com - █▌ █▌ █▌ ██▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄██


ftp://glftpd:glftpd2.1.1@gnix.myftp.org:65535 SSL
.h .htm .txt binary mode