Accessing files via FTP

https://www.monitorteknologi.com/wp-content/uploads/2019/12/Apa-Itu-FTP-Server-Dan-Bagaimana-Cara-Kerjanya.jpg

So having Samba to solve all my local file sharing needs is great. I also have Plex which has its own media server service as well as it provides DLNA on my home network. There is though one more option I want to add, and that's FTP. FTP will allow most devices that don't  have network share access to get files from my Linux server. So I'll do an apt install of FTPD, and I'll stick to the basic rather than VSFTPD. Once FTP is installed, we can begin to have some fun. In the .conf I allow for anonymous log in and anonymous write/remove access.

Once the .conf was fixed, I got to the part that made me want to create a blog entry. Accessing folders via FTP. Anonymous log in sends you to the default FTP folder that is in /srv/ftp. This folder is locked by root. Now you can fiddle with permissions etc, but there is a quicker way. Create a new user and use your desired share as their home directory. 

sudo adduser ftpuser

This will lead to some prompt allowing you to give the user a password as well as add full user information. Once that is done, then all that is left to do is change the permission on the folder we wish to share. a-w allows us to read, remove and write. Next, we give ownership of the folder to the ftpuser account and group. Finally, we then change the home folder of the user to the desired share.  

sudo chmod a-w /desired/share
sudo chown ftpuser:ftpuser /desired/share
sudo usermod -d /desired/share ftpuser

Now I can log in using FileZilla or in Windows explorer and access my shared folder via FTP. Symbolic Links don't work in FTP, and so it goes without saying that you will either have to move everything into one folder, or you will need to configure accounts for each share you want.

Post a Comment

Previous Post Next Post