Hi Greg,
sftp will also try to find the known_hosts file (~/.ssh/known_hosts) in the
current users home directory.
If your logged in as a user other than biz, you will also need to point to
the other users known_hosts file.
Try the following by telling sftp where to find the known_hosts file.
sftp -i /home/biz/.ssh/id_rsa -o
UserKnownHostsFile=/home/biz/.ssh/known_hosts biz@xxxxxxxxxxxxxx
Another option would be to change the command to ssh instead of sftp, then
the system will ask you if you want to add a new host key. Then the sftp
command should work.
Rob W
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Greg
Wilburn
Sent: Tuesday, April 29, 2025 12:16 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: sFTP User Name - does it need to match user name on the server
Let me explain...
If you want to log into a remote machine from a local one, and want to
use a specific private (!) keyfile locally, > use the -i option. If said
keyfile is named id_rsa or whatever crypto stuff was used, and it's
contained in the user's home directory, subdirectory .ssh, the ssh, sftp and
scp commands find the file automatically.
This is what I want to do... I've tried to use the -i option to indicate the
location of the keys, but I must not have the syntax correct.
I get "Host key verification failed"
So if the key is in /home/biz/.ssh and is called id_rsa, what is the correct
syntax for the command line option?
sftp -I /home/biz/.ssh/id_rsa biz@xxxxxxxxxxxxxx did not work
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Patrik
Schindler
Sent: Tuesday, April 29, 2025 2:49 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: sFTP User Name - does it need to match user name on the server
Hello Greg,
Am 29.04.2025 um 20:29 schrieb Greg Wilburn
<gwilburn@xxxxxxxxxxxxxxxxxxxxxxx>:
I know this goes back a while... but I can't seem to find the "appropriate
command line switch" on the SFTP command to point to the public key.
In my case, the key is in /home/biz/.ssh
If I log on as user "biz" I can establish a connection.
If I log on as another user, I cannot connect unless I CHGUSPRF
USRPRF(me) HOMEDIR('/home/biz')
I'll be using this in batch... what am I missing?
I'm confused about which direction you're talking. :-)
If you log into a machine via any ssh protocol, the public key is read by
the server (job). It is always found in the connecting user's home
directory, subdirectory .ssh, file authorized_keys.
If you want to log into a remote machine from a local one, and want to use a
specific private (!) keyfile locally, use the -i option. If said keyfile is
named id_rsa or whatever crypto stuff was used, and it's contained in the
user's home directory, subdirectory .ssh, the ssh, sftp and scp commands
find the file automatically. No need to specify -i.
If you want to connect as another user to the remote machine, use
username@destination.
Does that help?
:wq! PoC
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Greg Wilburn
Director of IT
301.895.3792 ext. 1231
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
.
As an Amazon Associate we earn from qualifying purchases.