Friday, May 16, 2008

glftpd and zipscript install guide

So, you need an FTP server on your box, and you don't know which one you should use? I'll solve that dilemma for you. glftpd is easy to install and is a fully functional, fairly robust FTP server.

That being said, lets get started! (NOTE: if any command spits back a permissions error, simply put sudo in front of the command).

cd /tmp/
tar -xzf glftpd-LNX_2.01.tgz

Let's grab the dependencies we need to get glftpd to work properly

apt-get install xinetd zip unzip openssl tcpd

Now, we move into the glftpd directory

cd glftpd-LNX_2.01

For the prompts, do:

Use tcpd? [Y]es [N]o: Y
Use a jailed environment? [Y]es [N]o: N
Please enter the directory to install glftpd to [/glftpd]: (press enter) - Installing into /glftpd is the best way to go, imo
Press for the default (glftpd)> (press enter)

The install will then compile (hopefully with no errors).

Enter the port you would like glftpd to listen on [1337]: (pick any port, I suggest something in the higher # range, 40000 plus)
Do you want to use [I]netd or [X]inetd? X
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
Please specify location, inside /glftpd, to install the cert (ftpd-dsa.pem) [/etc]: (press enter)
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): (you can put just about anything here...doesn't matter)

It will then create your certificate. Once that's done, glftpd is almost completely set up.

What you'll want to do next is set up your user account for the FTP. To do this, you:

ftp localhost port
user: glftpd
password: glftpd

This will get you logged in.

Once logged in, you want to create a user, set its flags, set its ratio, set its logins, set its ratio, etc.

site adduser user password ip [e.g., site adduser ronin hdwhore And no, don't use localhost as your IP..was just using that as an example.
site change ronin ratio 0
site change ronin num_logins 0 (if you want unlimited logins to your FTP)
site change ronin flags +1ABCDEFGH

That takes care of the account. Now you're going to want to edit the glftpd.conf. 

To do so, you:

nano /etc/glftpd.conf

There's not much you NEED to edit here, so I'll just highlight what you should.

sitename_long MY[:space:]SITE[:space:]NAME (put whatever you feel like here)
sitename_short MSN (short version of the above
# TLS enforcements.
userrejectsecure !*
userrejectinsecure !* (remove the ! to enable Auth TLS requirements for login)
denydiruncrypted !*
denydatauncrypted !*

The rest doesn't need to be touched, unless you so choose to. CTRL+O, press ENTER, CTRL+X, and you're done editing the file. That completes the install for glftpd. Now, for zipscript.

cd /tmp/
tar -xzf

When that's done, you need to edit zipscript/conf/zsconfig.h

nano zipscript/conf/zsconfig.h

I recommend changing the following folder listings below:

#define zip_dirs "/site/"
#define sfv_dirs "/site/test/ /site/incoming/mp3/ /site/incoming/games/ /site/incoming/apps/ /site/incoming/musicvideos/ /site/incoming/requests/"
#define audio_nocheck_dirs "/site/groups/ /site/incoming/requests/"
#define check_for_missing_nfo_dirs "/site/incoming/games/ /site/incoming/apps/"

If you don't do music, ignore the auto_nocheck variable

You'll also want to edit:

#define short_sitename "NG"

CTRL+O, PRESS ENTER, CTRL+X, and you're done editing zsconfig.h

make install
cd scripts/libcopy/
chmod 666 /glftpd/ftp-data/logs/dupelog (this assumes you installed into /glftpd/)
nano /etc/crontab/
paste the below into your crontab
59 23 * * * chroot /glftpd /bin/cleanup >/dev/null 2>&1
29 4 * * * chroot /glftpd /bin/datacleaner >/dev/null 2>&1

Once that's done, you have 1 more step, and zipscript is complete.

nano /etc/glftpd.conf

Copy/paste this somewhere into your glftpd.conf

calc_crc *
post_check /bin/zipscript-c *
cscript DELE post /bin/postdel
cscript RMD post /bin/datacleaner
cscript SITE[:space:]NUKE post /bin/cleanup
cscript SITE[:space:]UNNUKE post /bin/postunnuke
cscript SITE[:space:]WIPE post /bin/cleanup

site_cmd RESCAN EXEC /bin/rescan
custom-rescan !8 *

cscript RETR post /bin/dl_speedtest

site_cmd AUDIOSORT EXEC /bin/audiosort
custom-audiosort !8 *


You'll likely want to chmod the incoming (/glftpd/site/incoming) to 777, and any other directory you might dump into:

chmod -R 777 /glftp/site/*

Once that's done, you're done setting up your zipscript.

You now have a fully functioning FTP and file checker installed on your box, and it's ready to be used.

No comments: