eyespie
Posts: 2
Joined: Wed Mar 05, 2014 7:52 am

How can I restrict ftp on raspbmc?

Wed Mar 05, 2014 8:27 am

Hello there, I want to know how I can go about limiting the folders that the ftp service raspbmc accesses. At present it offers up the complete root directory which makes me feel a little uneasy. I want to restrict it to a usb stick in /media/.

I've looked at some tutorials online and played with installing vsftpd in raspbian without problems. It was my impression that raspbmc used vsftpd because vsftpd.conf exists in /etc/ by defualt. But when I edit the the file i can't seem to get anywhere. Furthermore, when I try to stop/start the service it says vsftpd is not installed. Why the config file? Is it just a dummy? Any thoughts on what to do next would be helpful. Thanks.

Angelus88
Posts: 442
Joined: Mon May 13, 2013 9:25 am
Location: Ivrea, TO (Italy)

Re: How can I restrict ftp on raspbmc?

Wed Mar 05, 2014 2:11 pm

Try:

Code: Select all

sudo apt-get remove --purge vsftpd*
sudo apt-get install vsftpd
This way we can reinstall the ftp server.

After that, you have to change vsftpd.conf file in order to have:

Code: Select all

chroot_local_user=YES
local_root = /media/usbstickfolder
and then restart the service:

Code: Select all

sudo service vsftpd restart

eyespie
Posts: 2
Joined: Wed Mar 05, 2014 7:52 am

Re: How can I restrict ftp on raspbmc?

Fri Mar 07, 2014 6:07 am

Thank you for your reply Angelus88 but it didn't seem to solve the problem.

I followed the instructions.

sudo apt-get remove --purge vsftpd*, then reinstalled and added the two to the new configuration file /etc/vsftpd.conf.

When I tried access the server via filezilla on another computer I got an error:
Response: 500 OOPS: vsftpd: refusing to run with writable root inside chroot()
Error: Critical error
Error: Could not connect to server

I tried to google the error and read somewhere you need to create folders within the root folder such as /usbstick/ftp/files. I didn't work for me.

I tried adding allow_writable_root=YES but that all seemed to have no effect.

After trying a few other things - such as attempting to install and uninstall and start from scratch I'm a bit confused. I can't call up the service - if I try sudo service vsftpd start and then sudo service status I get vsftpd is not running.

If I try sudo apt-get remove --purge vsftpd* again the system states:

E: Unable to locate package vsftpd.conf
E: couldn't find ange package by regex 'vsftpd.conf'

but if I try to install then - the system states: "vsftpd is already newest version".

whereis vsftpd results in : /usr/sbin/vsftpd /etc/vsftpd.conf /usr/share/man/man8/vsftpd.8.gz

User avatar
DougieLawson
Posts: 39183
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How can I restrict ftp on raspbmc?

Fri Mar 07, 2014 8:32 am

sudo apt-get purge "vsftp*"

Are you aware that ftp is one of the bigger security holes and that sshd provides sftp support for free, already installed and ready to go?
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Beginners”