Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: How to connect connet/mount with SFTP and private key

  1. #1
    Join Date
    Sep 2008
    Beans
    69

    How to connect connet/mount with SFTP and private key

    How can I connect&mount to a remote server using SFTP when the servers SSH is configured to use a private key for authentication?

  2. #2
    Join Date
    Oct 2006
    Beans
    4,624
    Distro
    Kubuntu 15.04 Vivid Vervet

    Re: How to connect connet/mount with SFTP and private key

    You can use Nautilus. Just do Places > Connect to server and select SSH from the drop down. If you already have your key setup on the server there's nothing more to do. It will automatically use the appropriate key.
    Blog | Ubuntu User #15350 | Zsh FTW | Ubuntu Security | Nothing to hide?
    AMD Phenom II X6 1075T @ 3GHz, Nvidia GTX 650, 8GB DDR3 RAM, 2 X 1TB, 1 X 3TB HDD
    Please don't request support via PM


  3. #3
    Join Date
    Mar 2007
    Beans
    127
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: How to connect connet/mount with SFTP and private key

    Slicehost has a great article here. It's pretty straight forward:

    http://articles.slicehost.com/2008/1...d-setup-page-1

  4. #4
    Join Date
    Sep 2008
    Beans
    69

    Re: How to connect connet/mount with SFTP and private key

    Quote Originally Posted by FuturePilot View Post
    You can use Nautilus. Just do Places > Connect to server and select SSH from the drop down. If you already have your key setup on the server there's nothing more to do. It will automatically use the appropriate key.
    Ok, good to know that "Connect to Server" can handle this - that is what i was hoping.

    I suppose then my next question is how do I set up the key. I was provided the private key. Where do I put it and what do I do with it so that nautilus will be able to find/use it.

  5. #5
    Join Date
    Oct 2006
    Beans
    4,624
    Distro
    Kubuntu 15.04 Vivid Vervet

    Re: How to connect connet/mount with SFTP and private key

    Quote Originally Posted by acroporas View Post
    Ok, good to know that "Connect to Server" can handle this - that is what i was hoping.

    I suppose then my next question is how do I set up the key. I was provided the private key. Where do I put it and what do I do with it so that nautilus will be able to find/use it.
    Put the private key in ~/.ssh/. That's a hidden directory in your home directory so press Ctrl+H in the file manager to show the hidden files.
    Blog | Ubuntu User #15350 | Zsh FTW | Ubuntu Security | Nothing to hide?
    AMD Phenom II X6 1075T @ 3GHz, Nvidia GTX 650, 8GB DDR3 RAM, 2 X 1TB, 1 X 3TB HDD
    Please don't request support via PM


  6. #6
    Join Date
    Feb 2009
    Beans
    143

    Re: How to connect connet/mount with SFTP and private key

    I expect Nautilus will probably use ssh-agent to manage keys so it will probably expect your private key to be in on of these:

    ~/.ssh/id_rsa
    ~/.ssh/id_dsa
    ~/.ssh/identity

    You should put the key in the appropriate file.
    The default is ~/.ssh/identity for protocol version 1, and ~/.ssh/id_rsa and ~/.ssh/id_dsa for protocol version 2.
    From ssh manual

    I'd advise you check your key actually works first by manually loading it then seeing if you ssh into the remote host.

    You can do that using the command line.
    Code:
    ssh -i /path/to/your/private_key -v username@remotehost.com
    You can also try loading your key into ssh-agent. In ubuntu it seems ssh-agent is always running so you don't need to load it first, it will ask for your password if it's not a passwordless key.
    Code:
    ssh-add /path/to/your/private_key
    If you can log-in then your key works. If it doesn't then the verbose output of ssh will tell you why.

    Personally I wouldn't use Nautilus to log-in at all. I would use sshfs to mount a directory on your remote host instead and then happily browse it with nautilus.
    Last edited by delcypher; November 13th, 2009 at 08:02 PM.

  7. #7
    Join Date
    Sep 2008
    Beans
    69

    Re: How to connect connet/mount with SFTP and private key

    Quote Originally Posted by FuturePilot View Post
    Put the private key in ~/.ssh/. That's a hidden directory in your home directory so press Ctrl+H in the file manager to show the hidden files.


    Ok, I must not be explaining things properly, but It still is not working, thanks for being patient with me.

    The server I am trying to connect to is an amazon ec2 server running ubuntu.

    Amazon's instructions for connecting via ssh are:

    Code:
     ssh -i {filename goes here}.pem root@{address goes here}.com
    I paste this code into the terminal and it does connect.

    So based on the instructions I just received from you guys, I:

    - copied the {filename goes here}.pem file to the .ssh directory.
    - Clicked "Connect To Server"
    - selected ssh as type
    - entered {address goes here}.com into the server field
    - entered root into the username field
    - clicked connect

    I then get a popup that says Permission denied
    Last edited by acroporas; November 13th, 2009 at 08:08 PM.

  8. #8
    Join Date
    Sep 2008
    Beans
    69

    Re: How to connect connet/mount with SFTP and private key

    Quote Originally Posted by delcypher View Post
    Personally I wouldn't use Nautilus to log-in at all. I would use sshfs to mount a directory on your remote host instead and then happily browse it with nautilus.
    Well if sshfs is an easier way to mount a directory, I would love to learn more. Would you be so kind as to post some example code for how I might mount the directory with sshfs?

    In the mean time, I will be trying to figure out the rest of your post.

    Thanks

  9. #9
    Join Date
    Sep 2008
    Beans
    69

    Re: How to connect connet/mount with SFTP and private key

    Quote Originally Posted by delcypher View Post
    You can also try loading your key into ssh-agent. In ubuntu it seems ssh-agent is always running so you don't need to load it first, it will ask for your password if it's not a passwordless key.
    Code:
    ssh-add /path/to/your/private_key
    If you can log-in then your key works. If it doesn't then the verbose output of ssh will tell you why.
    That right there was the trick. After doing that it works. Thank you so much.


  10. #10
    Join Date
    Oct 2006
    Beans
    4,624
    Distro
    Kubuntu 15.04 Vivid Vervet

    Re: How to connect connet/mount with SFTP and private key

    Quote Originally Posted by acroporas View Post
    Ok, I must not be explaining things properly, but It still is not working, thanks for being patient with me.

    The server I am trying to connect to is an amazon ec2 server running ubuntu.

    Amazon's instructions for connecting via ssh are:

    Code:
     ssh -i {filename goes here}.pem root@{address goes here}.com
    I paste this code into the terminal and it does connect.

    So based on the instructions I just received from you guys, I:

    - copied the {filename goes here}.pem file to the .ssh directory.
    - Clicked "Connect To Server"
    - selected ssh as type
    - entered {address goes here}.com into the server field
    - entered root into the username field
    - clicked connect

    I then get a popup that says Permission denied
    Oh, now I see. I'm guessing .pem is different from the usual id_rsa type keys? I don't really know. If using it from the command line works there should be a way to make it work but I'm not exactly sure how.

    Edit: never mind I see you have solved it
    Blog | Ubuntu User #15350 | Zsh FTW | Ubuntu Security | Nothing to hide?
    AMD Phenom II X6 1075T @ 3GHz, Nvidia GTX 650, 8GB DDR3 RAM, 2 X 1TB, 1 X 3TB HDD
    Please don't request support via PM


Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •