Trying to set up SSH Keys from Linux client to Linux sFTP server. Permission denied (publickey)

PROGKCP

New Member
Joined
May 20, 2023
Messages
2
Reaction score
1
Credits
28
sFTP server - Oracle Linux 7
Linux client - Oracle Linux 7

I've created an sFTP server, first time doing this.
I think it works as I can log in to my sFTP server using the command $ sftp sftp_user@sftp_server_IP - and then enter the correct password, and I'm logged into sFTP.

I have ssh keys working between a Linux client and the Linux sFTP server. So, I can ssh between the client and sFTP server both ways without a password.

My problem is that I'm trying to connect from the client to the sFTP server without a password, and this doesn't work.

sftp sftp_user@sftp_server_IP
Permission denied (publickey)
Couldn't read packet: Connection reset by peer

Any suggestions?
 


I usually have to use the ssh key.

sftp -i /home/user/.ssh/privateKey [email protected]

I don't have any Redhat 7 systems left, most are running 9 now.
 
Last edited:
The way that I was setting up my keys was wrong.

Also, the sFTP server was set up with a chroot jailed user and I think that was set up wrong which was keeping me from running the ssh-copy-id command.

I removed the chroot stuff and then ran the following and now all is well. I can now add the chroot stuff back in, I think.




Removed chroot jailed user stuff.

Run all below from the Linux client machine.


ssh-keygen -t ed25519 -f ~/.ssh/sftp_server_IP-ed25519 -C 'Progkcp from sftpclient'


If the ss-copy-id works, move on to the next step.
ssh-copy-id -i ~/.ssh/sftp_server_IP-ed25519 sftp_user@sftp_server_IP


Login using the private key works. I'm connected to FTP without a password.
sftp -i ~/.ssh/sftp_server_ip-ed25519 sftp_user@sftp_server_ip



I made changes to the config file in ~/.ssh/config

Now this works as well.

Log in without a password.
sftp sftp_user@sftp_server_ip
 

Members online


Top