Difference between revisions of "SFTP"

From Tootsville Wiki-Wiki
Jump to: navigation, search
(Created page with "SFTP stands for Secure File Transfer Protocol. It is ''not'' the same as FTPS (another secure way to transfer files) or FTP (an ''insecure'' way to transfer files). Builde...")
(No difference)

Revision as of 09:47, 13 October 2016

SFTP stands for Secure File Transfer Protocol.

It is not the same as FTPS (another secure way to transfer files) or FTP (an insecure way to transfer files).

Builder Toots use SFTP to access certain server files.

Accessing from Linux

Getting Access Permissions

You'll need to generate an SFTP public key and be added to the permissions for the host beforehand.

You can use the program “Passwords and Keys” (Seahorse) to create this file. (If it doesn't appear in your applications screen in Activities Overview, install it with Gnome Software. Search for “Seahorse.”)

Open “Passwords and Keys.” In the left sidebar, look under “Secure Shell” for “OpenSSH Keys.”

Seahorse OpenSSH Keys.png

Creating a new key

If you do not have any keys listed yet, create a new key.

Click the blue “+” sign.

Seahorse Create OpenSSH.png

Select “Secure Shell Key” and click “Continue.”

Seahorse Create OpenSSH Step2.png

Enter your e-mail address. You can adjust the Advanced settings, but RSA 2048 or higher is recommended.

Click on Just Create Key.

You may add a protective passphrase if you would like to, or, just hit Return/Enter to skip it.

Exporting the Public Key file

Now, click on the OpenSSH key to highlight it. From the menu bar, pick File → Export….

Choose a location to save the “.pub” file. You might want to rename it to your own name — for example, instead of “id-rsa.pub” you might instead save it as “john-doe.pub” or so.

Send this public key file via any method you like (eg: e-mail) to the person who is setting up your SFTP access.

Connecting

In Gnome Files (aka Nautilus):

Open Files.

In the lower-left corner, look for the “Other Locations” label. (You may have to scroll down in the left sidebar.)

Nautilus Other Locations.png

Click “Other Locations,” then enter the SFTP address. The form will usually be:

     sftp://YOUR-USERNAME@REMOTE-HOSTNAME.tootsville.adventuring.click/SOME/FOLDER/PATH/

Nautilus SFTP Location.png

Click “Connect.”

If your private key is protected by a passphrase, you may have to enter it now.

The first time you connect, you may see a confirmation message about the fingerprint of the remote server. This is to make sure that you're not connecting to a machine at the other end that's just pretending to be the server you expected. Check it against the value you were given before accepting it.

Accessing from MacOS

Needed: instructions on creating a key and exporting as a public key

Connecting from Finder …

Accessing from Windows

Windows does not yet have built-in SSH or SFTP abilities, but you can download the free program Putty to help.

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

You probably want to download the MSI file: scroll down and look for something in the green box like:

      A Windows MSI installer package for everything except PuTTYtel
      Installer: putty-0.67-installer.msi (or by FTP) (signature)

After downloading, double-click the MSI file and follow its on-screen instructions as usual.

Create a public/private key

Launch the program PuttyGen

PuttyGen Interface.png

Make sure that you selected at the bottom panel either SSH-2 RSA or SSH-2 DSA and that the number of bits is at least 2048. Then, click Generate.

Follow the directions (wiggle the mouse over the blank area) to create the key.

Change to Key comment to your e-mail address. (The default will be some nonsense like “rsa-key-20161013.”)

Click “Save Public Key” and choose a location. You'll want to name the file something like your name “.pub” — eg “john-doe.pub”.

Send that key file to the person who's setting up your access. That file can be published — by itself (without the private, secret key on your computer) it's useless.

Accessing the Host

Open a Terminal (aka “Command Prompt”) window. (You can do this by holding the “super” — or Windows logo — key, and press “R,” then type “CMD” and Enter)

Use the CD command to go to the local folder that you want to transfer files to/from. You can type “CD ” (c, d, space) and then drag a folder icon into the Terminal, and then press Enter.

    CD "C:/Users/YOURNAME_01/Documents/Tootsville/Stuff"

Connect to the remote server by typing the location of the PSFTP.exe program — you can also drag the PSFTP icon into the window to fill it in for you. Then, type “open ”, followed by everything after “sftp://” in the address to which you want to connect. For example, to connect to “sftp://yourname@hostname.tootsville.adventuring.click” you might type:

     C:/> "C:/Program Files (x86)/Putty/bin/psftp.exe" 
     PSFTP> open yourname@hostname.tootsville.adventuring.click

You can then enter PSFTP Commands to interact with the remote server.

Typically, you will use:

  • “cd” to change directories,
  • “pwd” (Print Working Directory) to show the current directory's name,
  • “ls” or “dir” to list files and directories,
  • “get” or “mget” or “reget” to fetch a remote file to your system,
  • “pet” or “mput” or “reput” to send a local file to the remote system.

Check the Putty manual for command information.