• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

ssh login throwing error

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi im trying to log into a server on local network with code


but is throwing the error when i try to connect


anyone know what is causing this any help for a noob would be great thanks
 
Sheriff
Posts: 22772
130
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

john bean wrote:


Can you login manually as the same user? I doubt it, because I get a feeling that you're trying to connect using a system account. Those aren't meant to be used to login as, not locally and not remotely.
 
Saloon Keeper
Posts: 27478
195
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:

john bean wrote:


Can you login manually as the same user? I doubt it, because I get a feeling that you're trying to connect using a system account. Those aren't meant to be used to login as, not locally and not remotely.


I concur. I'm pretty sure that the real meaning of that message is "No home directory defined for that user on the ssh server".
 
Marshal
Posts: 4392
567
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It appears like the problem is that it did not find a property for the (client) user's home directory (maybe it is needed to look for something under its .ssh directory).

In org.apache.sshd.common.config.keys.IdentityUtils:
 
Tim Holloway
Saloon Keeper
Posts: 27478
195
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:It appears like the problem is that it did not find a property for the (client) user's home directory (maybe it is needed to look for something under its .ssh directory).



Allowing for whatever funny business systemd has been up to lately, the remote user's home directory is defined in /etc/passwd and attached to that user's specific login ID, regardless of whether it's a local or remote login. An SSH client can immediately cd somewhere else, if it's set up properly as part of the ssh login process, but I think that there does have to be a fixed initial home defined on the server.
 
Ron McLeod
Marshal
Posts: 4392
567
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This failure is occurring on the client side, before any network interaction with the server.

My guess would be that the client implementation wants to look for the remote endpoint's public key which is normally stored in ~/.ssh/known_hosts, so it first needs a path the home directory.

Also, the OP's code is running on Android - I'm not sure where ssh information is stored in that case.
 
Tim Holloway
Saloon Keeper
Posts: 27478
195
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Android is built on top of Linux, so if you had root access, you probably would find the ingfrastructure there. Although since Android itself is a VM, like the regular JVM I wouldn't guarantee that that would be its one and only key registration database.

In any event, a known-hosts entry is created only when a remote client has successfully negotiated with a server and confirmed its identity.  The known-hosts file merely pairs the returned server key to its dial-in address (hostname or IP) and doesn't even carry user information. That part goes in the ssh authorized_keys file IF you copy a key from the server (using ssh-copy-id or similar).

So in short, I can see no reason for the client to know or care about either the client or the server's home directory. It's only the server that should be dealing with that.

Ergo, first, I'd check the user account definition on the server. If that checked out (and specifically if you could log in OK from a non-Android client), I'd check to make sure that the app wasn't using a library that's not actually Android-friendly.
 
Rob Spoor
Sheriff
Posts: 22772
130
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with both of you. I'd first check if you can actually login as this user before trying to fix the code. But Ron appears be right that the .ssh folder is missing. That means that the private key and known hosts need to be configured in a different way.
 
Tim Holloway
Saloon Keeper
Posts: 27478
195
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:But Ron appears be right that the .ssh folder is missing.



What bothers me about that is that Android's philosphy isn't filesystem-based as a rule. Most mutable storage is in databases.

As for alternate storage in the abstract, consider PuTTY for Windows. I actually have no idea where it keeps its host keys. Windows, after all doesn't support SSH natively (or PuTTY wouldn't have been created), and the idea of a hidden SSH folder isn't part of the standard Windows paradigm. Although for the most part, when mimicking Unix networking constructs Windows does tend to follow Unix.
 
Rob Spoor
Sheriff
Posts: 22772
130
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:As for alternate storage in the abstract, consider PuTTY for Windows. I actually have no idea where it keeps its host keys. Windows, after all doesn't support SSH natively (or PuTTY wouldn't have been created), and the idea of a hidden SSH folder isn't part of the standard Windows paradigm. Although for the most part, when mimicking Unix networking constructs Windows does tend to follow Unix.


Where else but in the Windows Registry, under key HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys. I had to check the about dialog to find the key under Software.
 
Tim Holloway
Saloon Keeper
Posts: 27478
195
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thus, PuTTY needs no user home directory (or .ssh/known hosts).
 
Rob Spoor
Sheriff
Posts: 22772
130
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, it uses the registry for all of its storage. It also use a file ~\AppData\Local\PUTTY.RND, but that's probably easily replacable.
 
Talk sense to a fool and he calls you foolish. -Euripides A foolish tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic