From b7ba0072ffcde79da8fd2d0e9d16d93e68486255 Mon Sep 17 00:00:00 2001 From: Cameron McEfee Date: Tue, 8 Mar 2011 11:43:03 -0800 Subject: Added ssh troubleshooting/condenced info into one file --- _includes/ssh_setup.markdown | 153 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 _includes/ssh_setup.markdown (limited to '_includes/ssh_setup.markdown') diff --git a/_includes/ssh_setup.markdown b/_includes/ssh_setup.markdown new file mode 100644 index 0000000..debf311 --- /dev/null +++ b/_includes/ssh_setup.markdown @@ -0,0 +1,153 @@ + +1. Check for SSH keys. Have an existing kepair? You can skip to Step 4. + + First, we need to check for existing ssh keys on your computer: + +
+	$ cd ~/.sshChecks to see if there is a directory named ".ssh" in your user directory
+	
+ + If it says “No such file or directory“ skip to __step 3__. Otherwise continue to __step 2__. + +2. Backup and remove existing SSH keys. + + Since there is already an SSH directory you’ll want to back the old one up and remove it: + +
+	$ lsLists all the subdirectories in the current directory
+	config	id_rsa	id_rsa.pub	known_hosts
+	$ mkdir key_backupmakes a subdirectory called "key_backup" in the current directory
+	$ cp id_rsa* key_backupCopies the contents of the id_rsa directory into key_backup	 
+	$ rm id_rsa*Deletes the contents of the id_rsa directory
+	
+ +3. Generate a new SSH key. + + To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter. + +
+	$ ssh-keygen -t rsa -C "your_email@youremail.com"Creates a new ssh key using the provided email
+	Generating public/private rsa key pair.
+	Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):
+	
+ + Now you need to enter a passphrase. + +
+

Why do passphrases matter?

+
+

Passwords aren’t very secure, you already know this. If you use one that’s easy to remember, it’s easier to guess or brute-force (try many options until one works). If you use one that’s random it’s hard to remember, and thus you’re more inclined to write the password down. Both of these are Very Bad Things™. This is why you’re using ssh keys.

+ +

But using a key without a passphrase is basically the same as writing down that random password in a file on your computer. Anyone who gains access to your drive has gained access to every system you use that key with. This is also a Very Bad Thing™. The solution is obvious: add a passphrase.

+ +

But I don’t want to enter a long passphrase every time I use the key!

+ +

Neither do we! Thankfully, there’s a nifty little tool called ssh-agent that can save your passphrase securely so you don’t have to re-enter it. If you’re on OSX Leopard or later your keys can be saved in the system’s keychain to make your life even easier.

+ +

For more information about SSH key passphrases, check out our help guide.

+
+
+ +
+	Enter passphrase (empty for no passphrase):
+	Enter same passphrase again:
+	
+ + Which should give you something like this: + +
+	Your identification has been saved in /Users/your_user_directory/.ssh/id_rsa.
+	Your public key has been saved in /Users/your_user_directory/.ssh/id_rsa.pub.
+	The key fingerprint is:
+	01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db user_name@username.com
+	The key's randomart image is:
+	+--[ RSA 2048]----+
+	|     .+   +      |
+	|       = o O .   |
+	|        = * *    |
+	|       o = +     |
+	|      o S .      |
+	|     o o =       |
+	|      o . E      |
+	|                 |
+	|                 |
+	+-----------------+
+	
+ +4. Add your SSH key to GitHub. + + On the GitHub site _Click “Account Settings”_ > _Click “SSH Public Keys”_ > _Click “Add another public key”_ + + Open the id_rsa.pub file with a text editor (Notepad or TextEdit will do just fine). This is your public SSH key. You may need turn on “view hidden files” to find it because the .ssh directory is hidden. __It’s important you copy your SSH key exactly as it is written without adding any newlines or whitespace.__ Now paste it into the “Key” field. + +
+

Can’t view hidden files? Other ways to copy:

+
+

OSX

+
+			$ pbcopy < ~/.ssh/id_rsa.pubCopies the contents of the id_rsa.pub file to your clipboard
+			
+

Windows

+

Unfortunately, there isn’t an easy way to do this from the command line for Windows users. You'll have to use the instructions above.

+

Linux

+
+			$ sudo apt-get install xclipDownloads and installs xclip
+			$ xclip -sel clip < ~/.ssh/id_rsa.pubCopies the contents of the id_rsa.pub file to your clipboard
+			
+
+
+ + Now paste it into the “Key” field. + + Paste your SSH Key + + Hit “Add Key.” + +5. Test everything out. + + To make sure everything is working you’ll now SSH to GitHub. Don’t change the “git@github.com” part. That’s supposed to be there. + +
+	$ ssh git@github.comAttempts to ssh to github
+	
+ + Which should give you this: + +
+	The authenticity of host 'github.com (207.97.227.239)' can't be established.
+	RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
+	Are you sure you want to continue connecting (yes/no)?
+	
+ + Don’t worry, this is supposed to happen. Type “yes”. + +
+	PTY allocation request failed on channel 0
+	Hi username! You've successfully authenticated, but GitHub does not provide shell access.
+	Connection to github.com closed.
+	
+ +
+

Having problems?

+
+

Setting up SSH can be problematic some times. Here are some frequent issues people run into:

+

SSH to GitHub

+

When it came time to run $ ssh git@github.com did you type your own email in there? If you did, you will need to run it again, making sure it says “git@github.com”. This is important because it is the address you are trying to SSH to (GitHub), not your email address.

+

Sudo

+

Are you using sudo? If you don’t know what that means, then you probably aren’t. If you are using it, stop! You shouldn’t use sudo unless you have a very good reason.

+

Agent admitted failure to sign using the key

+

This one only seems to happen to Linux users. To solve it, try this:

+
+			ssh-add ~/.ssh/id_rsaAssociates your ssh key with ssh-agent
+			
+

If that doesn’t solve it, check out this thread.

+

My connection was refused

+

You may be blocked by a firewall. First, you should check your ssh debug info:

+
+			ssh -v git@github.comPrints debug info for the git@github.com SSH connection
+			
+

Make sure it is connecting to GitHub on port 22. If it is, check to make sure your firewall is not blocking port 22.

+

When all else fails

+

If none of these solved your problem, check out this guide or contact GitHub support

+
+
\ No newline at end of file -- cgit v1.3.1