SSH, SFTP, and SSH keys
All things you need to know about SSH, SFTP, and SSH keys
- How do I create SSH keys on Windows?
- How do I create SSH keys on Mac?
- How do I SSH on Windows using PuTTY?
- How do I SSH on Mac?
- How do I install and use FileZilla?
How do I create SSH keys on Windows?
Instructions on how to create an SSH key on Windows using PuTTYGen.
Instructions based on: https://www.ssh.com/academy/ssh/putty/windows/puttygen
- Launch the program PuTTYgen from your start menu
- At the bottom of the window that pops up, set the number of bits to
4096
- Click Generate. Then wait for the progress bar to complete. Once complete the screen should look like the following
- In the Key passphrase area, put a strong password. You will need this password to log into the server.
- Confirm the passphrase in Confirm passphrase
- Save both the public and private key for safekeeping. You will need the private key to log in.
- Copy and email me the text in the Public key for pasting into OpenSSH authorized_key file textbox.
How do I create SSH keys on Mac?
Instructions on how to create SSH keys on a Mac.
- Open the Terminal window
- Run the command
ssh-keygen -b 4096 -t rsa
- In the Enter file in which to save the key prompt enter the same text in the parenthesis but change
id_rsa
to your username_phs. That way it is identifiable
Ex:Enter file in which to save the key (/home/youruser/.ssh/id_rsa): /home/youruser/.ssh/username_phs
- In the Enter passphrase prompt, give it a strong password. You will need this to log into the server
- Confirm your passphrase
- Type the following command and email me the text that it sends you:
Remember to changeyouruser
to your mac username.cat /home/youruser/.ssh/username_phs.pub
How do I SSH on Windows using PuTTY?
Instructions on how to SSH to a server using PuTTY.
- Launch Putty from your start menu
- If you don't have it installed you can install it from here (use 64-bit x86 putty.exe): https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
- In the Host Name text box put in your server name.
- In the left hand side-bar, go to
Connection
>Data
- In the Auto-login username Enter your username for the server
- In the left hand side-bar, go to
Connection
>SSH
>Auth
- In the Private key file for authentication box, click on
Browse
and find your private key (It is the one that does NOT end with .pub)- If you don't see that field, then try
Connection
>SSH
>Auth
>Credentials
instead
- If you don't see that field, then try
- In the left hand side-bar, go back to
Session
(At the top) - In the Saved Sessions Textbox, enter a name and click
Save
You have set up your SSH Connection
In the future you can use this connection by double clicking on the server name listed in Saved Sessions and then clicking open (If necessary). A new window will open and prompt you for your passphrase.
How do I SSH on Mac?
Instructions on how to SSH to a server on Mac.
In the examples here we are setting up the ssh connection to the server mercury.ucdavis.edu
. We are also using the ssh key stored at ~/.ssh/mercury
you can change these to match the server and key you are using.
- Launch the Terminal and run the following commands:
cd ~/.ssh nano config
- It should now take you to a text editor in your terminal. Type the following:
Remember to change theusername
to your username for mercury and the IdentityFile to your private keyHost mercury.ucdavis.edu User username IdentityFile ~/.ssh/mercury
- Press
Control + X
and follow the on screen instructions to save your file
You have now set up your ssh connection.
You can ssh to the server by running ssh your.server.name
in the terminal:
For example:
ssh mercury.ucdavis.edu
How do I install and use FileZilla?
FileZilla is a simple way to transfer files to and from linux servers. Here are some instructions on how to use it.
Installation
-
Download FileZilla Here https://filezilla-project.org/download.php?show_all=1
- If you are a windows user you will want the top download
FileZilla_3.64.0_win64-setup.exe
- If you are a windows user you will want the top download
-
Run the downloaded file
- If it shows the "Do you want to allow..." prompt, go ahead and click yes
- Click
I Agree
- Select
Only for me
and clickNext
- You can leave everything else as default and just click Next until its complete.
-
Launch FileZilla
Setting Up FileZilla
These are one time setup instructions for FileZilla to use your private key
- Launch FileZilla
- In the top bar click
Edit
>Settings...
- In the left hand sidebar click
Connection
>SFTP
- Click on
Add key file...
and choose the private key you saved from PuTTYgen - Click OK to close the settings page
Transferring files
-
Near the top you will see a bar with fields you can enter text.
- Host: mercury.ucdavis.edu
- Username: Enter your username
- Password: Leave this blank
- Port: 22
-
Click
Quickconnect
-
Filezilla will likely ask you for a password. Go ahead and leave it blank again
- If this is your first time connecting, It will show an
Unknown host key
prompt. You can clickAlways trust this host
and then clickOK
- If this is your first time connecting, It will show an
-
Filezilla will then ask you for a password a third time, but this time it will have a Challenge section. Enter your private key's password here.
-
You should now be logged in it should similar to the image below.
You can now drag and drop your files from one side of the screen to the other. You can also drag and drop from another file browser into the right side of the screen to upload your files to mercury.
Progress bars will appear at the bottom of the screen.