FTP: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>UNiversal
mNo edit summary
m (Text replacement - "{{mininav| Media sources | File sharing }}" to "{{mininav| File sharing }}")
 
(23 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{XBMC faq toc Inline}}
{{mininav| [[File sharing]] }}
{{greenv|Instructions:|This page contains instructions on how-to install FTP server software}}
<section begin="intro"/>If you have media-files on a computer and you want to share them to a Kodi device, an [[w:FTP|FTP]] server is one option you can use.
{{redv|Notice:|Ensure your data is not compromised or accidentally overwritten or deleted when using/configuring any data transfer programs}}
By default Kodi (namely XBMCbuntu) does not have any FTP server software installed, that does not mean you cannot add a FTP server to the installation and use it. Here we defer to vsftpd as a example.<section end="intro"/>


If you have media-files on a computer and you want to share them to an XBMC device, an [[w:FTP|FTP]] server is one option you can use.
To accomplish this your Kodi device and FTP server must be able to reach each other through your network (firewall!)<br />
By default XBMC (namely XBMCbuntu) does not have any FTP server software installed, that does not mean you cannot add a FTP server to the installation and use it. Here we defer to vsftpd as a example.


To accomplish this your XBMC device and FTP server must be able to reach each other through your network (firewall!)<br />


 
== Install vsftpd server in Ubuntu and derivatives ==
==Other Protocols==
{{see also|SFTP|SSH}}
 
==Install vsftpd server in Ubuntu an other distros==
Connect to via:
Connect to via:
*username: '''xbmc'''
* username: '''xbmc'''
*password: password_you_used_during _install
* password: password_you_used_during _install
*port: 21
* port: 21
*IP: Your Machine IP. e.g. 192.168.1.254
* IP: Your Machine IP. e.g. 192.168.1.254


<source lang="bash">
<syntaxhighlight lang="bash" enclose="div">
sudo apt-get install vsftpd -y
sudo apt-get install vsftpd -y
</source>
</syntaxhighlight>


This is a quick script to configure vsftpd to accept connections as above with passive and FXP connections enabled.
This is a quick script to configure vsftpd to accept connections as above with passive and FXP connections enabled.


The script may not work for all cases bare in mind the FTPS settings if you wish to enable SSL which are no present below.
The script may not work for all cases bare in mind the FTPS settings if you wish to enable SSL which are no present below.
*''see also:'' '''[http://ubuntuforums.org/showthread.php?t=518293 How-to Easy FTP with vsftpd]'''
* ''see also:'' '''[http://ubuntuforums.org/showthread.php?t=518293 How-to Easy FTP with vsftpd]'''


<pre>#!/bin/bash
<syntaxhighlight lang="bash" enclose="div">#!/bin/bash
#Setup vsftpd.conf
#Setup vsftpd.conf
#You may use default configurration if you choose.
#You may use default configuration if you choose.
echo 'Setting up vsftpd'
echo 'Setting up vsftpd'
cp /etc/vsftpd.conf /etc/vsftpd.conf-backup; rm -f /etc/vsftpd.conf; touch /etc/vsftpd.conf
cp /etc/vsftpd.conf /etc/vsftpd.conf-backup; rm -f /etc/vsftpd.conf; touch /etc/vsftpd.conf
Line 48: Line 42:
echo 'chown_uploads=YES' >> /etc/vsftpd.conf
echo 'chown_uploads=YES' >> /etc/vsftpd.conf
echo 'chown_username=xbmc' >> /etc/vsftpd.conf
echo 'chown_username=xbmc' >> /etc/vsftpd.conf
echo 'ftpd_banner=Welcome to XBMC FTP Server' >> /etc/vsftpd.conf
echo 'ftpd_banner=Welcome to Kodi FTP Server' >> /etc/vsftpd.conf
echo 'chroot_local_user=NO' >> /etc/vsftpd.conf
echo 'chroot_local_user=NO' >> /etc/vsftpd.conf
echo 'secure_chroot_dir=/var/run/vsftpd/empty' >> /etc/vsftpd.conf
echo 'secure_chroot_dir=/var/run/vsftpd/empty' >> /etc/vsftpd.conf
Line 58: Line 52:
echo 'force_dot_files=YES' >> /etc/vsftpd.conf
echo 'force_dot_files=YES' >> /etc/vsftpd.conf
echo 'tcp_wrappers=YES' >> /etc/vsftpd.conf
echo 'tcp_wrappers=YES' >> /etc/vsftpd.conf
mkdir /home/vsftpd
touch /home/vsftpd/xferlog.log
touch /home/vsftpd/vsftpd.log
echo 'xferlog_file=/home/vsftpd/xferlog.log' >> /etc/vsftpd.conf
echo 'xferlog_file=/home/vsftpd/xferlog.log' >> /etc/vsftpd.conf
echo 'vsftpd_log_file=/home/vsftpd/vsftpd.log' >> /etc/vsftpd.conf
echo 'vsftpd_log_file=/home/vsftpd/vsftpd.log' >> /etc/vsftpd.conf
echo 'Setting up vsftpd, complete!'
echo 'Setting up vsftpd, complete!'
restart vsftpd
restart vsftpd
</pre>
</syntaxhighlight><br />
{{note|chmod script 755 and run with sudo ./nameofscript}}


Alternatively on a Linux distribution you can install the preferred FTP server for that distribution.
Alternatively on a Linux distribution you can install the preferred FTP server for that distribution.


==Adding a FTP Server in ATV 1/2/3==
== FTP server in OS X ==
There are guides on how-to install and enable FTP server on your ATV.
 
*''see also:'' '''[http://wiki.awkwardtv.org/wiki/Enable_FTP_Server Enable FTP Server on ATV]'''
 
==FTP server in OS X==
On a Mac (OS 10.6 and below) go to system preferences, then sharing, and then click the check box next to file sharing, this will start local file sharing on your machine.  Click the 'Options' Button to share files and folders using FTP/SMB/AFP, etc.  Choose your folders and you are good to go.
On a Mac (OS 10.6 and below) go to system preferences, then sharing, and then click the check box next to file sharing, this will start local file sharing on your machine.  Click the 'Options' Button to share files and folders using FTP/SMB/AFP, etc.  Choose your folders and you are good to go.


Line 78: Line 71:
To start it type the Terminal command:
To start it type the Terminal command:


<source lang="bash">
<syntaxhighlight lang="bash" enclose="div">
sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist
sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist
</source>
</syntaxhighlight>
   
   
To stop it:
To stop it:


<source lang="bash">
<syntaxhighlight lang="bash" enclose="div">
sudo -s launchctl unload -w /System/Library/LaunchDaemons/ftp.plist  
sudo -s launchctl unload -w /System/Library/LaunchDaemons/ftp.plist  
</source>
</syntaxhighlight>


To enable ftpd on Lion to survive reboots you will need to edit /System/Library/LaunchDaemons/ftp.plist by looking for the lines
To enable ftpd on Lion to survive reboots you will need to edit /System/Library/LaunchDaemons/ftp.plist by looking for the lines
Line 96: Line 89:
'''Enabled'''
'''Enabled'''


==Adding a FTP server in Windows==
== Adding a FTP server in Windows ==
On a Windows PC you can use a FTP server like e.g. [http://filezilla-project.org/ FileZilla Server].
On a Windows PC you can use a FTP server like e.g. [http://filezilla-project.org/ FileZilla Server].
*''see also:'' '''[http://lifehacker.com/339887/build-a-home-ftp-server-with-filezilla Build a home ftp server with filezilla]'''
* ''see also:'' '''[http://lifehacker.com/339887/build-a-home-ftp-server-with-filezilla Build a home ftp server with filezilla]'''


==Adding FTP as a source in XBMC==
== Adding FTP as a source in Kodi ==
On the XBMC device use '''Add Source''', select FTP, fill in the credentials and your XBMC device will be able to connect to that FTP server and play files more or less like if the files were local.
On the Kodi device use '''Add Source''', select FTP, fill in the credentials and your Kodi device will be able to connect to that FTP server and play files more or less like if the files were local.
{{see also|Video library/Adding media sources}}
{{see also|Adding_video_sources}}


# Add Videos
# Add Videos
Line 122: Line 115:
Keep in mind though, FTP is not made for streaming content, it will act a little different sometimes.
Keep in mind though, FTP is not made for streaming content, it will act a little different sometimes.


 
[[Category:Manual]]
[[Category:File Sharing]]
[[Category:File sharing]]

Latest revision as of 23:27, 29 January 2021

Home icon grey.png   ▶ File sharing ▶ FTP

If you have media-files on a computer and you want to share them to a Kodi device, an FTP server is one option you can use. By default Kodi (namely XBMCbuntu) does not have any FTP server software installed, that does not mean you cannot add a FTP server to the installation and use it. Here we defer to vsftpd as a example.

To accomplish this your Kodi device and FTP server must be able to reach each other through your network (firewall!)


Install vsftpd server in Ubuntu and derivatives

Connect to via:

  • username: xbmc
  • password: password_you_used_during _install
  • port: 21
  • IP: Your Machine IP. e.g. 192.168.1.254
sudo apt-get install vsftpd -y

This is a quick script to configure vsftpd to accept connections as above with passive and FXP connections enabled.

The script may not work for all cases bare in mind the FTPS settings if you wish to enable SSL which are no present below.

#!/bin/bash
#Setup vsftpd.conf
#You may use default configuration if you choose.
echo 'Setting up vsftpd'
cp /etc/vsftpd.conf /etc/vsftpd.conf-backup; rm -f /etc/vsftpd.conf; touch /etc/vsftpd.conf
echo 'listen=YES' >> /etc/vsftpd.conf
echo 'pasv_min_port=49152' >> /etc/vsftpd.conf
echo 'pasv_max_port=65535' >> /etc/vsftpd.conf
echo 'pasv_promiscuous=YES' >> /etc/vsftpd.conf
echo 'local_max_rate=0' >> /etc/vsftpd.conf
echo 'local_enable=YES' >> /etc/vsftpd.conf
echo 'write_enable=YES' >> /etc/vsftpd.conf
echo 'local_umask=077' >> /etc/vsftpd.conf
echo 'dirmessage_enable=YES' >> /etc/vsftpd.conf
echo 'use_localtime=YES' >> /etc/vsftpd.conf
echo 'xferlog_enable=YES' >> /etc/vsftpd.conf
echo 'connect_from_port_20=YES' >> /etc/vsftpd.conf
echo 'port_enable=NO' >> /etc/vsftpd.conf
echo 'chown_uploads=YES' >> /etc/vsftpd.conf
echo 'chown_username=xbmc' >> /etc/vsftpd.conf
echo 'ftpd_banner=Welcome to Kodi FTP Server' >> /etc/vsftpd.conf
echo 'chroot_local_user=NO' >> /etc/vsftpd.conf
echo 'secure_chroot_dir=/var/run/vsftpd/empty' >> /etc/vsftpd.conf
echo 'pam_service_name=vsftpd' >> /etc/vsftpd.conf
echo 'rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem' >> /etc/vsftpd.conf
echo 'async_abor_enable=YES' >> /etc/vsftpd.conf
echo 'anon_mkdir_write_enable=NO' >> /etc/vsftpd.conf
echo 'anon_other_write_enable=NO' >> /etc/vsftpd.conf
echo 'force_dot_files=YES' >> /etc/vsftpd.conf
echo 'tcp_wrappers=YES' >> /etc/vsftpd.conf
mkdir /home/vsftpd
touch /home/vsftpd/xferlog.log
touch /home/vsftpd/vsftpd.log
echo 'xferlog_file=/home/vsftpd/xferlog.log' >> /etc/vsftpd.conf
echo 'vsftpd_log_file=/home/vsftpd/vsftpd.log' >> /etc/vsftpd.conf
echo 'Setting up vsftpd, complete!'
restart vsftpd


Note: chmod script 755 and run with sudo ./nameofscript

Alternatively on a Linux distribution you can install the preferred FTP server for that distribution.

FTP server in OS X

On a Mac (OS 10.6 and below) go to system preferences, then sharing, and then click the check box next to file sharing, this will start local file sharing on your machine. Click the 'Options' Button to share files and folders using FTP/SMB/AFP, etc. Choose your folders and you are good to go.

OS X Lion seemingly has disabled FTP server, you can still enable it with the command line.

To start it type the Terminal command:

sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist

To stop it:

sudo -s launchctl unload -w /System/Library/LaunchDaemons/ftp.plist

To enable ftpd on Lion to survive reboots you will need to edit /System/Library/LaunchDaemons/ftp.plist by looking for the lines

Disabled

and changing them to

Enabled

Adding a FTP server in Windows

On a Windows PC you can use a FTP server like e.g. FileZilla Server.

Adding FTP as a source in Kodi

On the Kodi device use Add Source, select FTP, fill in the credentials and your Kodi device will be able to connect to that FTP server and play files more or less like if the files were local.

  1. Add Videos
  2. Browse
  3. Add network location
  4. Select FTP from the protocol menu
  5. Complete other fields as required

FTP Source Example (source.xml):

     <video>
        <source>
         <name>Remote FTP Videos</name>
         <path>ftp://username:[email protected]/share/videos/</path>
       </source>
     </video>

Keep in mind though, FTP is not made for streaming content, it will act a little different sometimes.