FTP onto the Ubuntu Gutsy Server
Getting an FTP client
Going to the Synaptic Package Manager on my Ubuntu desktop and typing ftp into the search bar, I find a popular little client called gFTP. I mark it for installation and click Apply. It downloads and installs successfully.
Flushed with optimism after the recent success with Apache, I launch the client and try to connect to the server using ftp.sylvarwolf.homelinux.com but the connection gets refused. Mmmm – either there is no ftp server installed on the server or I have not set up an ftp user.
Webmin
I just noticed that in Others>Upload and Download there is a facility to upload files directly to the server. That’s pretty amazing. However it would be nice to have an FTP server running so that I can give other members of the family their own accounts and enable them to build web-pages. So I go to Servers>ProFTPD Server which looks like it might do the job and it tells me that it cannot find it but offers me a chance to download and install using APT. Now that sounds good. So I follow the click here link.
Warning
Yesterday, I navigated away from the Webmin install page while it was installing and the server’s file system corrupted. So now I am just going to be patient and reason that if there is a problem it will timeout and tell me. Still waiting…
30 Minutes later and still the same. I did navigate away and decided to try apt-get install proftpd from the CLI. However, it tells me that /var/cache/apt/archives/lock is locked and I cannot lock the download directory. Mmmm….. I have just used Webmin’s file manager to delete this file and will try again from the CLI. Now that seemed to work. I chose inetd as the ftp server type as I’m not anticipating heavy load and Webmin now shows me all the options.
System Logs
Apparently system log files can consume a lot of space, so I go to System>Log File Rotation>Edit Global Options and set Maximum size before rotating to 50M (Mb) and the Number of old logs to keep to 4.
ProFTPD Configuration
1. Bases on the howto here, I used the file manager to add the line /bin/false to /etc/shells
2. Then navigate to /home and check my public directory is there. It is, so no problem there.
3. Then, using Webmin’s command shell, I add another ftpuser (coz I don’t know how to add to the one I’ve already got) by
useradd userftp -p <your_password> -d /home/public -s /bin/false
4. I switch over to the server to type: passwd userftp to make sure the password has been set.
5. Using Webmin’s file manager, I create directories called downloads and uploads in /home/public.
6. Clicking on /home/public in the right pane, I can then click on the Info button and take write access off for users and groups, setting permissions to 0755.
7. Then going to downloads I do the same (0755) and then uploads, I make sure that all access is enabled with 0777.
8. Going back to Servers>ProFTPD I then click on the Edit Config Files button to make the following changes:
UserAlias gary userftp
ServerType standalone (rather than inetd)
ShowSymlinks off
TimeoutStalled 100
TimeoutIdle 2200
RootLogin off (line added)
#It’s better for debug to create log files
(line added)
ExtendedLog /var/log/ftp.log (line added)
TransferLog /var/log/xferlog (line added)
SystemLog /var/log/syslog (line added)
(so I have to delete the log file lines found later)
#I don’t choose to use /etc/ftpusers files (line added)
UseFtpUsers off (line added)
MaxInstances 8
Uncomment PersistentPasswd so it reads ‘off’
MaxClients 8 (line added)
MaxClientsPerHost 8 (line added)
MaxClientsPerUser 8 (line added)
MaxHostsPerUser 8 (line added)
Then added the whole of the next section:
# Display a message after a successful login
AccessGrantMsg “welcome !!!”
# This message is displayed for each access good or not
ServerIdent on “you’re at home”
# Set /home/public directory as home directory
DefaultRoot /home/public
# Lock all the users in home directory, ***** really important *****
DefaultRoot ~
MaxLoginAttempts 5
#VALID LOGINS
<Limit LOGIN>
AllowUser userftp
DenyALL
</Limit>
<Directory /home/public>
Umask 022 022
AllowOverwrite off
<Limit MKD STOR DELE XMKD RNRF RNTO RMD XRMD>
DenyAll
</Limit>
</Directory>
<Directory /home/public/downloads/*>
Umask 022 022
AllowOverwrite off
<Limit MKD STOR DELE XMKD RNEF RNTO RMD XRMD>
DenyAll
</Limit>
</Directory>
<Directory> /home/public/uploads/>
Umask 022 022
AllowOverwrite on
<Limit READ RMD DELE>
DenyAll
</Limit>
<Limit STOR CWD MKD>
AllowAll
</Limit>
</Directory>
Controlling the Server
To start/stop/restart the server, I should be able to use:
/etc/init.d/proftpd start
/etc/init.d/proftpd stop
/etc/init.d/proftpd restart
Now this all works. It’s not quite what I want, i.e. writing html pages to the webserver but it’s a start.
Powered by ScribeFire.