enira.net

We are all living in a technological wasteland.

RSS
people

Slitaz project – Expansion – Part 2 – FTP Server

This FTP machine will get the ip 192.168.1.241. Still remember the ip script? Let’s make a call and reboot the server.

/home/base/ip.sh ftp 192.168.1 241 1
reboot

Now install the server and clean the cache.

tazpkg get-install pure-ftpd
tazpkg clean-cache

Once pureftpd is installed you will need to create the correct user for this. In this case I will use ftpgroup and ftpuser.

addgroup -S ftpgroup
adduser -SH ftpuser -G ftpgroup

Tip: to verify if the accounts exist cat the group and passwd file. If they mention ‘ftpgroup’ and ‘ftpuser’, everything is fine.

cat /etc/passwd 
cat /etc/group

So once the unix user is made, create the sub user(contributor in this case) in ‘/home/ftpusers’ and change the owner of the contributor map to ftpuser.

mkdir /home/ftpusers
mkdir /home/ftpusers/contributor
chown ftpuser -R /home/ftpusers/contributor

Now add ad new contributor user to ftpd and assign the unix user of this ftp user to ftpuser

pure-pw useradd contributor -u ftpuser -d /home/ftpusers/contributor
pure-pw mkdb

To verify if the user exists you can write:

pure-pw show contributor

You can see that this user operates under the ftpuser/ftpgroup.

root@base:/# pure-pw show contributor
 
Login              : contributor
Password           : $1$yljZ5iF0$RSfbAJ4ZDtyAQtjOYSKwg.
UID                : 100 (ftpuser)
GID                : 101 (ftpgroup)
Directory          : /home/ftpusers/contributor/./
Full name          :
Download bandwidth : 0 Kb (unlimited)
Upload   bandwidth : 0 Kb (unlimited)
Max files          : 0 (unlimited)
Max size           : 0 Mb (unlimited)
Ratio              : 0:0 (unlimited:unlimited)
Allowed local  IPs :
Denied  local  IPs :
Allowed client IPs :
Denied  client IPs :
Time restrictions  : 0000-0000 (unlimited)
Max sim sessions   : 0 (unlimited)

Now the user is done, create the startup script. First assign the service to load during startup. This can be done in the rcS.conf file.

nano /etc/rcS.conf
RUN_DAEMONS="dbus hald slim firewall dropbear lighttpd pure-ftpd"

Once this is done edit the daemons file to add the options that will be added to the service.

nano /etc/daemons.conf
# Pure FTPd
PUREFTPD_OPTIONS="-4 -H -A -B -j -l puredb:/etc/pureftpd.pdb"

Once this is done, edit the /etc/init.d/pure-ftp file. This is the service start file. Apparently there is a fuckup in this file as the pure-ftpd service isn’t like the others. It didn’t contain daemon options and everything is just in the startup script. And I don’t like that >:(. So let’s change it.

nano /etc/init.d/pure-ftpd

Find this line:

OPTIONS="-4 -H -A -B"

and replace it with:

OPTIONS=$PUREFTPD_OPTIONS

Voila FTP server is done, now reboot the machine and see if the service is running once you reboot:

ps | grep -i pure-ftpd
root@base:~# ps | grep -i pure-ftpd
 1392 root       0:00 pure-ftpd (SERVER)
 1436 root       0:00 grep -i pure-ftpd

If everything is running you should be able to connect to ftp://contributor@192.168.1.241/ with windows (or FileZilla, whatever client you are using.)

That’s it, below is the download link for this small tutorial:
ftp.7z (12,4 MB)

Leave a Reply

You must be logged in to post a comment.