## Credits and License

Document Created and Maintained by Andrea Veri

Copyright :

- Holder: Andrea Veri

- Year: 2006

## Ftp Server Settings

This Document will provide a lot of usefull informations regarding Ftp Servers, we will explain three different methods to run ftp servers, making examples that will make user's life easier. One of the three methods it's related to the MySql server, we will provide for it a paragraph that will explain how you can recover your server password if you have lost it. Methods List:

- Anonymous FTP

- FTP with both anonymous access and users with a passworded account

- FTP with mysql support for virtual users authentication

## Methods Explanation

- First Method: People can enter inside the server only with the anonymous account that havent got any password ,of course the server administrator will put a limit for the uploads to prevent users to put inside the server illegal files like pirated music/films/games.

- Second Method: This method let both anonymous and passworded account people to enter the server of course they will only access to a specified directory except for the user root that can view/modify/delete all files and/or folders.

- Third Method: This method let access the server only for some users groups that havent got a virtual users authentication shell account into the system. It uses a external mysql server that stores users informations.

## First Option : Anonymous FTP

Before start the creation of an anonymous ftp server ,you have to add a user called ftp into your system ,with a home directory too.This step is really easy, just follow this commands : useradd -d /home/ftp/ftp -s /bin/false ftp mkdir -p /home/ftp/upload Doing this only this account can be used to write in this folder. You can use more variables to specify what the ftp server will do here are some examples :

- -e let access the server only to anonymous users

- -s ftp user files cannot be downloaded

- -M let anonymous users to create folders

- -B it start the server with background demon

- -i anonymous users cant upload files

## Second Option : Both anonymous and passworded account users

To make possible to have in the same server both anonymous and passworded account users ,follow this easy commands:

- -B ,-i ,M, -r, -s same as above

- -u uid unable users with a specified uid to access the server

- -V Ip address only specified IPs will be able to access the server in non-anonymous mode

## Third Option : Virtual Users with Mysql Server support

To create a server with mysql support follow this steps :

- Download and install User Manager for PureFTPdyou can find it Here

- decompress it and upload all its contenute into your web server www directory and then point your browser to This Link

- Follow all the steps that the installer asks to you and copy and save pureftpd-mysql.conf into pureftpd user manager directory.

- Done .Access to the administration panel using This Link

## Mysql Password recovery (Usefull if you have lost your MySql root password)

Follow this easy steps to reset your password:

- Stop the mysql demon process using this command : /etc/init.d/mysql stop

- Start the mysqld demon process using the --skip-grant-tables option with this command(/usr/bin/mysqld --skip-grant-tables)

- start the mysql client process (mysql -u root)

- Reset/Update your password [SET PASSWORD FOR root@'localhost' = PASSWORD('password') ]

- This will only change the root password for root@localhost. If you have a root that can connect from everywhere, you should also do: SET PASSWORD FOR root@'%' = PASSWORD('password')

- Then stop the mysqld process and relaunch it with the classical way: /etc/init.d/mysql start

When you have completed all this steps ,you can easily access to your mysql server with the password you have set in the step before. An easy way to have a full control of your mysql server is (PhpMyAdmin), software made in php that can give you a web interface that can be very usefull to people that havent got a lot of confidence with bash .To install phpmyadmin on you server you will need to have three things:

- web server apache with php_mysql support for apache

- mysql server/mysql client installed

- Php

## Ftp Servers behind a router: Port Forwarding

The easiest way to imagine Port Forwarding is a combination of routing by port combined with packet rewriting. A convention router examines the packet and dispatches the packet on one of the destionations decided before by the lan administrator, depending on the packet's destination address.I can make an example ,if i have two computers in my lan and in one of them i have a working apache server and i want to make it accessible to outside lan people i can just forward all traffic that will come from outside requesting the 80 port to that pc.

## How can I use this method?

You have only to login with administrator account into your router configuration panel(every router company have got a different panel so this is not the default one for all routers)(to enter inside the panel you will have to use the router ip address(for example 192.168.0.1 or 10.0.0.2 and after the authentication method that every router request before the administration panel ,you will be inside).

This is the panel of conexant routers,as you can see there there are at the end of the page three writable spaces and one choice button :

- Public Port

- Private Port

- Choice button: Tcp/Udp Port

- Host Ip Address

Port Forwarding Ftp Servers is really easy, just compile previsious spaces as this paragraph shows:

- Public Port: 21

- Private Port: 21

- Choice button: Tcp

- Host Ip Address: Here you will have to put the lan IP of the computer that run the Ftp Server

After every writeable space is compiled, press the Add Settings button and restart your connection to see effects

Some port numbers that can be usefull too for building a complete server are:

- Ssh Servers : Port 22

- TeamSpeak Server : Port 8767-8768

- TelNet : Port 23

- Web Server : Port 80

- HTTPS : Port 443

- SMTP: Port 25

- POP3: Port 110