Score:0

configure ssh to avoid password prompt when I cannot access remote .ssh directory

ru flag

I need to programmatically upload and download files via an sftp connection to a remote server. My username has permission to access a certain remote directory through a password, but not the .ssh directory. Actually I cannot ssh into the remote server at all. I get the response:

This service allows sftp connections only.
Connection to www.example.com closed.

But for the purpose of this question, lets say I simply don't have the permission to copy my private key into the remote .ssh directory. So my question is:

How can I configure my local /.ssh/config file, to avoid being prompted for the password authentication?

Obviously I cannot copy a newly generated key-pair to the remote directory, as is suggested here, for the abovementioned reasons. But I must have a private key on my local machine for the ssh connection somwhere, right? Can I not simply pass the directory of that file to the IdentityFile option?

Score:1
km flag

Ask the administrator of that remote server to enable public key authentication for you. Because public key authentication needs to be supported both server side and from the client, you can't force it from the client alone.

For scripted access sshpass is a possible solution. That allows you to store your password in a file to automate logging in when you can't use key based authentication.

https://www.redhat.com/sysadmin/ssh-automation-sshpass is a useful resource for that.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.