LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-10-2014, 04:58 PM   #1
Phaethar
Member
 
Registered: Oct 2003
Location: MN
Distribution: CentOS, Fedora
Posts: 182

Rep: Reputation: 30
SFTP command uses different keys depending on where it's run


Hey all,

Weird question here, but I'm having some trouble with SFTP on a freshly build CentOS 6.5 system. This system will be replacing an old CentOS 5 system, which is fine in all other regards except SSH keys. I need to carry over some a RSA SSH key. This key was generated for 1 specific purpose, and has to remain the same. The key sits in the /home/user/.ssh2 folder, as putting it in the /home/user/.ssh folder caused issues with the existing dsa keys. This setup works fine on the CentOS 5 system.

So, when I run SFTP sftp -v -o IdentityFile=/home/user/.ssh2/id_rsa to see the output when logged into SSH, it works properly sends the proper public key:

debug1: Offering public key: /home/user/.ssh2/id_rsa

When I run the same exact command from the Gnome desktop, it uses the public key from the .ssh folder instead. And I have no idea why.

Is there something in the Gnome profile setup that I can change that may get this working properly? Any other reason why using the IdentityFile argument works properly through SSH, but not from the desktop?

Thanks!
 
Old 06-10-2014, 08:46 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,340

Rep: Reputation: 6146Reputation: 6146Reputation: 6146Reputation: 6146Reputation: 6146Reputation: 6146Reputation: 6146Reputation: 6146Reputation: 6146Reputation: 6146Reputation: 6146
Please define what you mean by run same exact command from the Gnome desktop.
 
Old 06-11-2014, 01:14 PM   #3
Phaethar
Member
 
Registered: Oct 2003
Location: MN
Distribution: CentOS, Fedora
Posts: 182

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by michaelk View Post
Please define what you mean by run same exact command from the Gnome desktop.
When I run the sftp command from a terminal window from the Gnome GUI, it uses the wrong public key.

When I ssh to the system using putty from my Windows system and run the exact same command as the same user, it uses the proper public key.


So, when I use putty from my system and connect via SSH, I can run the following command successfully:

sftp -v -o IdentityFile=/home/user/.ssh2/id_rsa user@host

With -v specified, I can watch the debug info and see that it uses the proper keys:

debug1: identity file /home/user/.ssh2/id_rsa type 1
debug1: Offering public key: /home/user/.ssh2/id_rsa


But, if I open a terminal window through Gnome on the system itself and run the exact same command as above, it offers a different public key:

debug1: identity file /home/user/.ssh2/id_rsa type 1 (it looks correct at this point)
debug1: Offering public key: user@systemname

It doesn't specify the full path of the public key, but as the remote host is rejecting the connection, it appears to be using the wrong key, most likely from the /home/user/.ssh folder. I've tried specifying the identity file as above, as well as creating a config file that points to the proper ssh key, and they both do the same thing. I can't figure out why this works when I run it from putty, and then fails when I run it from the desktop on the system. It makes no sense. What else could I be missing?

Last edited by Phaethar; 06-11-2014 at 04:55 PM.
 
Old 06-11-2014, 05:46 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,340

Rep: Reputation: 6146Reputation: 6146Reputation: 6146Reputation: 6146Reputation: 6146Reputation: 6146Reputation: 6146Reputation: 6146Reputation: 6146Reputation: 6146Reputation: 6146
Using -vvv will increase the amount of debug information which might answer the most likely question.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SFTP From Linux to Windows with Keys 30467659 Linux - Newbie 1 01-28-2014 02:05 PM
SFTP with both SSH keys and password 2buck56 Linux - Software 2 08-31-2013 04:40 PM
setup sftp to use ssh keys + LDAP hophilip Red Hat 1 07-05-2012 03:30 AM
sftp: run command after user exits? schwing Linux - Server 2 11-12-2009 11:11 PM
How do I use sftp to upload my web site? (no sftp tar command) johnMG Linux - Networking 6 06-21-2005 10:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration