LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-28-2022, 08:33 PM   #1
LT72884
Member
 
Registered: Jul 2012
Posts: 151
Blog Entries: 1

Rep: Reputation: Disabled
ubuntu client ssh private key


I have a windows box about 3 hours from my house. It has ssh server installed (bitvise). I have connectivity from multiple windows machines to it using keys, a specific username, and a passphrase.

I just installed ubuntu on a VM. I went to the file manager, then went to other connections and added sftp:// x.x.x.x:xxxx and it denies the connection. So here is my question; where do i put my username and private key on the ubuntu client so i can connect to the ssh server to put some files on it?

second question, what is a good sftp GUI client as well in case i need to use that at some point?

thanks
 
Old 12-29-2022, 04:11 AM   #2
lucmove
Senior Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian
Posts: 1,434

Rep: Reputation: 110Reputation: 110
With Linux, you must upload your ~/.ssh/id_rsa.pub key to the remote server. If you don't have it, generate it:

$ ssh-keygen -t rsa

Then upload it to the remote server:

$ ssh-copy-id -i ~/.ssh/id_rsa.pub -p [port number] username@x.x.x.x

You do that on the command line. You will be prompted to enter your password.

But you say the server runs Windows. I'm not sure this approach will work. Sorry. Good luck.
 
Old 12-29-2022, 09:34 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
Can your VM connect to the Internet?
Is password authentication disabled on the server?
As far as I know bitvise can use rsa keys so it should doable.

Try Filezilla.
 
Old 12-29-2022, 12:39 PM   #4
LT72884
Member
 
Registered: Jul 2012
Posts: 151

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by lucmove View Post
With Linux, you must upload your ~/.ssh/id_rsa.pub key to the remote server. If you don't have it, generate it:

$ ssh-keygen -t rsa

Then upload it to the remote server:

$ ssh-copy-id -i ~/.ssh/id_rsa.pub -p [port number] username@x.x.x.x

You do that on the command line. You will be prompted to enter your password.

But you say the server runs Windows. I'm not sure this approach will work. Sorry. Good luck.
I have password authentication off on the server for security. Before any hosts connect, i turn that off

the public key is already on the ssh server. Its the private key thats the issue. All my other machines can connect to the ssh server with no issue using the public/private key generated by the ssh server.


IE, i use the bitvise ssh server key manager to generate a key pair, then i export only the private key to the machines that need to connect. so i have one public key on the server, and 3 private keys that have been exported from that public key for the clients if that makes sense haha. Then each client gets their private key. I then open the sftp client gui such as bitvise client or filezilla, open the private key, enter the username and it connects.

linux should have no issue communicating with a windows box?

I think we can get this to work.

thanks
 
Old 12-29-2022, 01:02 PM   #5
LT72884
Member
 
Registered: Jul 2012
Posts: 151

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
Can your VM connect to the Internet?
Is password authentication disabled on the server?
As far as I know bitvise can use rsa keys so it should doable.

Try Filezilla.
the VM can indeed connect to the internet. I do know its hitting the server because the error that comes back is "connection denied" If i turn off the internet the error is "network unavailable" or something close to that.

I have password authentication off for security. I have the bitvise server generate a key pair, then i export the private key and give it to each client that needs to connect. So far thats 2 haha. Ubuntu will be the 3rd client.

the other machines were up in 3 minutes. so far im into this ubuntu machine 12 days with no connectivity and its driving me crazy haha
 
Old 12-29-2022, 02:44 PM   #6
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 799

Rep: Reputation: 256Reputation: 256Reputation: 256
I have an Android device, trying to connect to a Linux host that uses OpenSSH (modern). The older Android stuff (Connectbot) can't make use of new OpenSSH keys, and I'm getting errors like yours. Ubuntu is likely using newer OpenSSH keys. Your Windows SSH server might not like that. Or the Ubuntu client might not want to use those keys. I'd try Windows -> Linux SSH server and see if that works. Android's OpenSSH client -> Linux does work. This might be a key operability issue, on either the client or server, because it doesn't sound like a connectivity issue. Did you look at the logs? Just throwing this out there, in hopes it might lead to a solution.

sftp user@host

Is a working command, assuming public key login and standard port.
 
Old 12-29-2022, 02:53 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
Did you create rsa keys?
If so you can copy the private key to your user's .ssh directory but it needs to have the correct permissions.
 
Old 12-29-2022, 04:38 PM   #8
LT72884
Member
 
Registered: Jul 2012
Posts: 151

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by jayjwa View Post
I have an Android device, trying to connect to a Linux host that uses OpenSSH (modern). The older Android stuff (Connectbot) can't make use of new OpenSSH keys, and I'm getting errors like yours. Ubuntu is likely using newer OpenSSH keys. Your Windows SSH server might not like that. Or the Ubuntu client might not want to use those keys. I'd try Windows -> Linux SSH server and see if that works. Android's OpenSSH client -> Linux does work. This might be a key operability issue, on either the client or server, because it doesn't sound like a connectivity issue. Did you look at the logs? Just throwing this out there, in hopes it might lead to a solution.

sftp user@host

Is a working command, assuming public key login and standard port.
it is using the newest version of open ssh and documentation says it works with all current versions of linux in 2022

Its a matter of not knowing where i need to put the private key on the ubuntu machine. It connects, but is denied the connection due to not having a key..
 
Old 12-29-2022, 04:39 PM   #9
LT72884
Member
 
Registered: Jul 2012
Posts: 151

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
Did you create rsa keys?
If so you can copy the private key to your user's .ssh directory but it needs to have the correct permissions.
es i have created the keys. Bitvise has a key manager and generates the rsa key pair.

I did find the .ssh directory like you speak of, and even with it pasted in there, it still does not work. Im guessing permissions like you say?

chmod the file to what numbers?

thanks

Last edited by LT72884; 12-29-2022 at 04:42 PM.
 
Old 12-29-2022, 05:02 PM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
Private key should be 600.

If the key name isn't id_rsa you might need to specify it using a config file. Try from the command line

sftp -P port# -i /path/private_key_name name@server_address
 
Old 12-29-2022, 05:30 PM   #11
LT72884
Member
 
Registered: Jul 2012
Posts: 151

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
Private key should be 600.

If the key name isn't id_rsa you might need to specify it using a config file. Try from the command line

sftp -P port# -i /path/private_key_name name@server_address
i just used the key to connect to the server from filezilla in ubuntu, so i know the key works.

in the command line i get the following:


Load key error in libcrypto
permission denied
connection closed

but yet its the same key i used for filezilla and it worked just fine.

the key does have a password on it

Last edited by LT72884; 12-29-2022 at 05:34 PM.
 
Old 01-01-2023, 07:33 PM   #12
LT72884
Member
 
Registered: Jul 2012
Posts: 151

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
any new answers or possible information
thaks
 
Old 01-05-2023, 12:19 AM   #13
LT72884
Member
 
Registered: Jul 2012
Posts: 151

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
I figured it out. Someone else duplicated my exact setup in a lab and they were able to get it to work. What happened was my key works with file zilla and all clients, but something happened during the export/conversion that it corrupted the key and the libcrypto doesnt like it.

i am know generating ECDSA keys from the client itself
 
  


Reply



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
LXer: Passwordless SSH login using public key and private key LXer Syndicated Linux News 0 02-23-2020 06:42 PM
How do I convert a putty private key to be used as a private key on a RedHat or Ubuntu Server greavette Linux - General 2 06-26-2019 08:40 PM
SSH skips public key authentication for a key, but works with another key simopal6 Linux - General 1 07-06-2011 08:33 AM
Public key, private key explained calande Linux - Security 3 06-12-2008 05:23 AM
RSA public key encryption/private key decription koningshoed Linux - Security 1 08-08-2002 07:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:17 PM.

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