Editing on a PC running on the Pi

Just a quick bonus guide.

Working on the Pi can be fun, but often it’s easier to do any editing from my main machine (a PC in my case). Certainly you can use SSH to get a connection, and indeed I do use this for running code. But editing via SSH even with nano can be a pain and vi does not do it for me.

So how do I use a PC editor on the Pi?

Well in my case I use my NAS as a go between.

Stage 1 set up a share on the NAS, I tend to call this “openshare” , this will depend entirely on you NAS make, so I won’t go into details on that. But what you will need to do, is to create a new user called “pi” and give it a password. You could use the same password as you use on the Pi itself, but I prefer to use something different. Make sure this user and the connection you use from the PC have both read and write access to the new share.

Stage 2 we go to the Pi (via SSH) and install cifs and make the mount point on the Pi.

sudo apt-get install cifs-utils
sudo mkdir /openshare

Once we have this done, we can setup the mounting details. We do this by adding a line to the /etc/fstab file, so use nano as:

sudo nano /etc/fstab

Now at the bottom of the file add the line:

//MyNAS/openshare /openshare cifs username=pi,password=SharePassword,file_mode=0777,dir_mode=0777 0 0

Note this is all one line but it wraps on this post.

  • //MyNAS/openshare should be replaced with name and share on your NAS
  • /openshare should be the folder you made on the Pi
  • SharePassword should be the password you set up on the NAS for the user “pi”

The file mode and dir mode flags are set so that there are no permission issues on the pi.

Save the updated file and reboot the pi.

When you next connect to the Pi it will probably not look any different as usually the Pi will try to setup the mounts before the network has been setup and hence it will not automatically mount. However once you are logged in, simply type the command:

sudo mount -a

This will mount the share on the Pi, you can then go to the folder /openshare and see all the files that are on this share on the NAS.

I tend to have separate folders under the openshare one for each project. Simply edit the files using whatever tools you want on the PC and when they are saved they are immediacy accessible to the Pi.

For example edit the circular.py file in Sublime text on the PC, save the file (Ctrl S) and open the SSH to the Pi (if not already open) and you can run it. If there are errors, you see them in the SSH window and can edit and correct them in the PC editor.

Example Editor, windows file explorer and putty SSH into the same files

More Colours

After yesterdays post, I had a bit of feedback asking if there would be other vendors colours (not just the Vallejo Game Colour range). The original post with how I got these charts can be found here. As I was able to get the RGB values from a few other ranges, I have now generated…

Investigations into colour theory and painting

One of my hobbies is miniature painting, it’s something I did a long time ago and found myself getting back into a year or so back. Now I am nowhere near an expert on this, but do like to work on techniques and ideas I see online and on the dreaded Youtube. That’s where I…

Formatting in WordPress

This page is a test, but might help. I originally was using this page to help me to try out new layout styles and techniques. But it ended up having information which might be useful to others, so it’s published rather than being internal only. I would like to use the various plug-ins and in…

ESP8266 – A small WiFi enabled microprocessor

This blog page is a bit of a waffle on how I found out about the ESP8266 and my process for getting it working for me. If you want a technical description on connecting one up and getting code running, then the ESP8266 Getting Started Guide should help. My introduction to ESP8266’s Some time ago,…

Loading…

Something went wrong. Please refresh the page and/or try again.

Get new content delivered directly to your inbox.

%d bloggers like this: