From time to time you may need to transfer files between your OSMC device and your computer to edit, add or change files that are already there. Some reasons to do this are:

  • To edit /etc/fstab to add NAS mounts to your OSMC install
  • To edit /etc/apt/sources.list to allow you to use test versions of OSMC and install other software not found in the default Debian repositories
  • To transfer backups to and from your device

For basic file transfer you don’t really need much background knowledge but if you need to move files into privileged locations or if you want to edit files then you’ll first need to know how to access the command line, there is an article covering command line access here.


Transferring files

There are many different ways to transfer files and the one that best suits you largely depends on your previous experience. Some of these methods will work out-of-the-box (Provided you have not disabled SSH) but some will require additional features to be installed on your OSMC device like the Samba (SMB) server or the FTP server.

Windows

macOS

  • FTP (Cyberduck/FileZilla/Command line) - Needs FTP server running on OSMC)
  • SCP (Command line)
  • SFTP (Cyberduck/FileZilla)
  • SMB - Needs Samba (SMB) server running on OSMC
  • USB transfer

Linux

  • FTP (FileZilla/Command line) - Needs FTP server running on OSMC)
  • SCP (Command line)
  • SFTP (FileZilla)
  • SMB - Needs Samba (SMB) server running on OSMC
  • USB transfer

For simplicity we’ll focus on just SFTP using FileZilla as this works on all three platforms (Windows, macOS and Linux) out-of-the-box with no additional changes needed to OSMC (Provided you have not disabled SSH).

When you first open FileZilla you won’t be connected to anything, you’ll need to provide the Host, Username and Password.

Host: sftp://ip-address-of-your-osmc
Username: osmc
Password: osmc (Or your user-specified password)
Port: Can be left blank to use the default SSH port of 22

Once these are entered, simply click the Quickconnect button and a connection will be established.

Now that you are connected you can upload/download files by simply dragging them. Your computer is represented by the folders on the left and OSMC is represented by the folders on the right. Drag from left to right to upload files to OSMC, drag from right to left to download files from OSMC.

There is a more detailed tutorial on using FileZilla here;
https://wiki.filezilla-project.org/FileZilla_Client_Tutorial_(en)


Editing files

For editing files from the command line we’d recommend using the nano text editor, this is fairly simple to use. To use the editor just call it with;
nano <filename>

e.g.
nano examplefile.txt
Would open a file called examplefile.txt within the current working directory for editing. If this file doesn’t already exist then nano would still open and the file would be created upon saving.

Nano is nice to use as it shows you the available commands at the bottom of the screen. Most of the time you can just get by with one command, CTRL+X. If you have made changes to the file you’ll be prompted to save it, if not Nano will simply close.

Remember, if you need to edit files in privileged locations (Typically most places other than your home drive) then you’ll need to sudo nano to give Nano the correct permissions.


Troubleshooting

I get permission denied when transferring files to /etc (for example).

This is because you are likely logged in as the OSMC user and the OSMC user only has read/write access to the home directory (/home/osmc). If you want to copy files to other parts of the system then there are a couple of ways to do this but the way we’d recommend doing so would be to first transfer the files to the OSMC home directory and then as a secondary step, moving them to the desired location.

SSH in to OSMC and issue to the following commands;
sudo mv <file-to-move> <destination-path>

e.g.
sudo mv examplefile.txt /etc
Would move a file called example.txt from the home drive to /etc

The man page for the mv command is here, have a read and see what else mv can do.

I get permissions denied when saving an edited file

This is likely because you are trying to edit a system file or a file that is not within the OSMC home directory. You can easily overcome this issue by using the sudo command to elevate the permissions that nano runs under.

e.g.
sudo nano /etc/fstab
sudo nano /etc/apt/sources.list


What you shouldn’t keep on your SD card

There are some things that we recommend that you not keep on your SD card, things like media files (Movies, Music, Photos) really ought to be stored separately from the operating system. This is for a few reasons;

  • Media files are large and the OSMC operating system storage is typically quite limited. If you fill up the operating system storage with media files then you may run into issues with the operation of OSMC.
  • The installation of OSMC performs a wipe of the storage, this could be very inconvenient for you the user if all your media was wiped when all you wanted was a fresh install of OSMC.

A note on software

We have mentioned software packages like Cyberduck, FileZilla and WinSCP. These are some that work but there are many-many more out there. OSMC uses standard protocols so if you have a preferred software package then try it and it’ll likely work.