Musings and Experiments on the Art and Science of 3D Printing


File sharing with OctoPrint

By SublimeLayers Saturday, December 10, 2016
In a previous post I addressed installing OctoPi (OctoPrint on a Raspberry Pi) for controlling the RAMBo on my SeeMeCNC Rostock MAX. OctoPrint has been working well and makes managing the printer and prints a lot easier via wireless. Along the way, I came across Samba - a suite of utilities for Linux & Unix systems that allows sharing their file systems with Windows and Mac computers with the SMB/CIFS protocol. Basically, with Samba, directories on the Raspberry Pi can be shared with desktop systems so you can slice a model and save the gcode directly into the Pi's gcode folder where it will automatically show up in the OctoPrint print list to be printed! Very convenient. Here's how to do it:

First install Samba on your RPi. Log into the RPi with SSH. Once there, we'll use the apt-get utility to install Samba. I found my apt-get needed to be updated before it could locate the samba resources. On the RPi command line, run:
sudo apt-get update

Then install samba with:
sudo apt-get install samba samba-common-bin

Once the install completes (both of the above steps may take a minute or more) you need to add the pi user to the SMB password list. Note, if you changed your username from the default pi, simply replace that in the following command:
sudo smbpasswd -a pi

You will be prompted to enter and verify a password. Choose something you'll remember.

Next you should enable write access on the upload folder:
sudo chmod 777 /home/pi/.octoprint/uploads

Finally, you need to edit the smb.conf configuration file to publish the uploads folder. 
cd /etc/samba

Then edit the file with:
sudo nano /etc/samba/smb.conf

Scroll down in the file until you find a line that starts with [printers], we'll insert the configuration for the folder above that. Copy and paste the following at that point:
comment = OctoPrint Uploads
path = /home/pi/.octoprint/uploads
writeable = Yes
only guest = Yes
create mask = 0777
directory mask = 0777
browseable = Yes
public = yes

and save the file (^-O to write followed by ^-X to exit). Finally, reboot the RPi:
sudo reboot now

Once the RPi has rebooted, you should be able to find it on your network. For OSX select the Finder's Go->Connect to Server... menu and click the Browse... button. Your RPi should show up in the Network-> section. Click on it and click the Connect button. You'll be asked for your username and password. Once you've connected, two folders should appear - pi and uploads.
Managing gcode files on OctoPrint is much easier and faster!

2 comments to ''File sharing with OctoPrint"

  1. Oh man, I really wanted that to work. Everything ran without error. Edited smb.conf. Rebooted and nothing. Maybe I have to boot my PC as well? I'll have a try...

  2. Tnx for the great tutorial!

    However I have the following problem when trying to create a samba password for the user pi

    'failed to add entry for user pi' (after I type in the password twice)

    Do you have any idea why that is?