Transferring Files

Tutorial: Getting Started

From the Linux Command Line

If you spend alot of time on the command line, it's good to know how to transfer files over SSH. Through the magic of linux, the scp (Secure Copy) command reads your SSH Config file. I assume you've setup your config so that you can connect using ssh grandline. For a sample config, visit the Connecting to ~grandline page.

The general format is very simple: scp origin destination. Note that a colon must be added after a remote host, as shown in the examples below. Also, both of the below commands must be run on your local computer. Running them on ~grandline will not work because ~grandline has no way to ssh into your local computer.

To transfer a file from your computer to ~grandline: scp ~/myfile.txt grandline:~/mydir/

To transfer a file from ~grandline to your computer: scp grandline:~/mydir/myfile ./

If those paths look weird to you, then you should read the Filesystem Explanation.

Configuring FileZilla on Linux

Even for those who love the command line, having a drag and drop GUI option can be a lifesaver at times. FileZilla is the GUI solution for all of your FTP and SFTP needs.

  1. Install FileZilla
  2. Open FileZilla
  3. Click the leftmost button in the toolbar called "Open the Site Manager"
  4. Click on "New Site"
  5. Enter a name for the site (e.g. "Grandline")
  6. Enter jahschwa.com in "Host"
  7. Change "Protocol" to "SFTP - SSH File Transfer Protocol"
  8. Change "Logon Type" to "Normal"
  9. Enter your remote username in "User"
  10. Make sure "Password" is blank
  11. Click "OK" to save the configuration

Configuring FileZilla on Windows

First follow all of the steps described above in the "Configuring FileZilla on Linux" section, then follow the steps listed below. Install it using this link.

  1. Open the "Edit" menu and click "Settings"
  2. Click on "SFTP" on the left
  3. Click the "Add keyfile..." button near the bottom
  4. Browse to and select your id_rsa.ppk file and click "Open"
  5. Click "OK" to save the settings

Using FileZilla (All Platforms)

FileZilla is very easy to use, since it has drag-and-drop functionality for all platforms. You should note that the top-most white box in the window prints status messages. Below this on the left are your local files, and on the right are the files on ~grandline. Double-clicking a files copies it to the current directory of the opposite side. The top boxes on the left and right show the directory structure, and the bottom boxes on the left and right show the contents of the current directory. The bottom-most box shows the status of current and pending file transfers.

  1. Open FileZilla
  2. Click the down arrow next to the "Open the Site Manager" button
  3. Click on "Grandline" or whatever name you used
  4. Drag files from the left to the right or vice versa

Editing Files with FileZilla

In order to edit a remote file, you can transfer it to your local machine with FileZilla, edit it in some program, save it locally, and finally transfer it back to ~grandline. FileZilla also gives you a second option. For Linux users I highly recommend the editor Geany, and for Windows users Notepad++.

IMPORTANT: If you try to edit files from ~grandline using notepad on Windows, you will have problems because Linux and Windows use different newline characters. Use Notepad++ instead.

  1. Right-click on a remote file on the right side of FileZilla
  2. Choose the "View/Edit" option
  3. Edit and save the file using your editor of choice
  4. Return to FileZilla
  5. Answer "Yes" to the prompt about uploading

You may have to edit FileZilla's settings to use your text editor for HTML (and other) file types when using the "View/Edit" method. To do so follow the steps listed below.

  1. Open the "Edit" menu and click "Settings"
  2. Click on "Filetype associations" under "File editing" on the left
  3. Enter a file extension followed by the path to your editor (example below)
  4. Click "OK" to save the settings

html C:\Program Files (x86)\Notepad++\Notepad++.exe

Mounting ~grandline Using SSHFS on Linux

You can do something pretty cool on Linux, since abstractions allow for arbitrary filesystems. Bascially, you can mount ~grandline over SSH as though it were a removable USB drive. This is accomplished using the SSHFS (SSH File System) package. This lets you use your distro's GUI to do everything from file browsing to editing. I don't know if this will work on Mac OS, and if you want it on Windows you're gonna have to Google. Note that some connectivity issues may occur since you are editing files over your internet connection. Use with mild caution over spotty wifi.

  1. Install SSHFS (e.g. sudo apt-get install sshfs)
  2. Create a folder at which to mount ~grandline such as ~/mnt/grandline
  3. Mount it with sshfs grandline:/home/username/ ~/mnt/grandline
  4. You can now browse to ~/mnt/grandline in your file browser and do whatever you want to the files
  5. If you want to unmount it, use sudo umount ~/mnt/grandline

Mounting ~grandline Using SSHFS on Windows

Turns out you can do SSHFS on Windows too, although the project is no longer under active development so you may encounter bugs or unpathced security vulnerabilities. Use at your own risk.

  1. Download it from here
  2. Install it, run it, and you'll get a new icon in your system tray
  3. Create a new share, using the same info from the FileZilla section
  4. Specify a drive letter, which will appear as a new drive in My Computer
  5. Mount your new share (YMMV)

If you have issues with the link above, I've recently had success with this fork. Also requires this library.

Conclusion

If you haven't done so already, I highly recommend that you read through the the Linux filesystem explanation so you understand what you're doing when transferring files. Now that you can transfer and edit files, let's look at some of the cool things I've implemented on ~grandline that you can customize by reading the Customizing Grandline page.