Kamis, 17 November 2016

Raspberry FTP Server

FTP Server Installation

We are close to having all the things for a good web server. Now we need to install FTP. I used ProFTPD for FTP.
sudo apt-get install proftpd
This will ask you to choose init.d or standalone, choose any one of them but I used standalone for this tutorial.
Next, we are going to change the config of proftpd.
sudo nano /etc/proftpd/proftpd.conf
You need to change the following lines. The ServerName should be the IP of your Raspberry Pi. Here we used 192.168.1.88. Yours can be different.
Server Name "192.168.1.88"
Uncomment the # in front of DefaultRoot text. This is a good practice.
# Use this to jail all users in their homes
 DefaultRoot
Next, we restart proftpd service
sudo service proftpd restart
To make sure that FTP service runs automatically at startup, enter the following code
update-rc.d proftpd defaults
Now we need to add a user for FTP. I am using “real” as the username. You can choose anything you like.
sudo useradd real
Set password the user with the following command
sudo passwd real
Assign the “/var/www/html/” directory to the user. This is the directory where the files will need to be added and the user will see this directory when they login using FTP client.Ignore message that says the directory already exists
sudo usermod -m -d /var/www/html real
Run the following commands to give permissions to the user on the html folder.
cd /var/www
sudo chown real:real -R html
FTP setup is done at this point. However, I found it is easier for me to do one extra step to avoid permissions. I edited apache2.conf file to make Apache use the user and group that we created.
sudo nano /etc/apache2/apache2.conf
Look for the following line and add # in front of User and Group lines. After editing, it should look like the following
# These need to be set in /etc/apache2/envvars
# User ${APACHE_RUN_USER}
# Group ${APACHE_RUN_GROUP}
User real
Group real

Tidak ada komentar:

Posting Komentar