Index: wp-admin/includes/class-wp-filesystem-ssh2.php
===================================================================
--- wp-admin/includes/class-wp-filesystem-ssh2.php	(revision 10485)
+++ wp-admin/includes/class-wp-filesystem-ssh2.php	(working copy)
@@ -84,20 +84,19 @@
 			$this->wp_base = $opt['base'];
 
 		// Check if the options provided are OK.
-		if ( empty ($opt['username']) )
-			$this->errors->add('empty_username', __('SSH2 username is required'));
-		else
-			$this->options['username'] = $opt['username'];
-
-		if ( ( !empty ($opt['public_key']) ) && ( !empty ($opt['private_key']) ) ) {
+		if ( !empty ($opt['public_key']) && !empty ($opt['private_key']) ) {
 			$this->options['public_key'] = $opt['public_key'];
 			$this->options['private_key'] = $opt['private_key'];
 
-			$this->options['hostkey'] = array("hostkey" => "ssh-rsa");
+			$this->options['hostkey'] = array('hostkey' => 'ssh-rsa');
 
 			$this->keys = true;
+		} elseif ( empty ($opt['username']) ) {
+			$this->errors->add('empty_username', __('SSH2 username is required'));
 		}
 
+		if ( !empty($opt['username']) )
+			$this->options['username'] = $opt['username'];
 
 		if ( empty ($opt['password']) ) {
 			if ( !$this->keys )	//	 password can be blank if we are using keys
@@ -114,7 +113,7 @@
 		if ( ! $this->keys ) {
 			$this->link = @ssh2_connect($this->options['hostname'], $this->options['port']);
 		} else {
-			$this->link = @ssh2_connect($this->options['hostname'], $this->options['port'], $this->options['hostkey']);
+			$this->link = ssh2_connect($this->options['hostname'], $this->options['port'], $this->options['hostkey']);
 		}
 
 		if ( ! $this->link ) {
@@ -128,7 +127,7 @@
 				return false;
 			}
 		} else {
-			if ( ! @ssh2_auth_pubkey_file($this->link, $this->options['username'], $this->options['public_key'], $this->options['private_key'], $this->options['password'] ) ) {
+			if ( ! ssh2_auth_pubkey_file($this->link, $this->options['username'], $this->options['public_key'], $this->options['private_key'] ) ) { //, $this->options['password']
 				$this->errors->add('auth', sprintf(__('Public and Private keys incorrent for %s'), $this->options['username']));
 				return false;
 			}
Index: wp-admin/includes/file.php
===================================================================
--- wp-admin/includes/file.php	(revision 10485)
+++ wp-admin/includes/file.php	(working copy)
@@ -681,8 +681,12 @@
 		$credentials['connection_type'] = 'ftps';
 	else if ( !isset($credentials['connection_type']) || (isset($_POST['connection_type']) && 'ftp' == $_POST['connection_type']) )
 		$credentials['connection_type'] = 'ftp';
-
-	if ( ! $error && !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) {
+var_Dump($credentials);
+	if ( ! $error && 
+			(
+				( !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) ||
+				( 'ssh' == $credentials['connection_type'] && !empty($credentials['public_key']) && !empty($credentials['private_key']) )
+			) ) {
 		$stored_credentials = $credentials;
 		if ( !empty($stored_credentials['port']) ) //save port as part of hostname to simplify above code.
 			$stored_credentials['hostname'] .= ':' . $stored_credentials['port'];
@@ -743,7 +747,7 @@
 <label for="public_key"><?php _e('Public Key:') ?></label ><br />
 <label for="private_key"><?php _e('Private Key:') ?></label>
 </div></th>
-<td><br /><input name="public_key" type="text" id="public_key" value=""<?php if( defined('FTP_PUBKEY') ) echo ' disabled="disabled"' ?> size="40" /><br /><input name="private_key" type="text" id="private_key" value=""<?php if( defined('FTP_PRIKEY') ) echo ' disabled="disabled"' ?> size="40" />
+<td><br /><input name="public_key" type="text" id="public_key" value="<?php echo attribute_escape($public_key) ?>"<?php if( defined('FTP_PUBKEY') ) echo ' disabled="disabled"' ?> size="40" /><br /><input name="private_key" type="text" id="private_key" value="<?php echo attribute_escape($private_key) ?>"<?php if( defined('FTP_PRIKEY') ) echo ' disabled="disabled"' ?> size="40" />
 <div><?php _e('Enter the location on the server where the keys are located. If a passphrase is needed, enter that in the password field above.') ?></div></td>
 </tr>
 
