Score:1

Able to connect to server via ssh but not via sftp (bash -> zsh)

lk flag

OS: Ubuntu 20.04

Hello everyone,

I am able to connect to a remote machine via my terminal:

ssh remote_name

Nonetheless I cannot connect via sftp (thus not able to use Nautilus to access my remote files).

sftp remote_name

The remote name is stored in my .ssh/config file like this:

Host remote_name
        HostName remote_adress
        User user_name

The authentification is done via a keyfile: my .ssh/id_rsa.pub key is stored in my remote machine at .ssh/authorized_keys.

[EDIT] I realized the issue appeared after I tried to change my "default" shell on my remote machine. Unfortunately, this is a shared server so I cannot set my default shell using chsh... So I'm just calling zsh at the end of my .bashrc.

That is the cause of my problme as suggested by this post: https://unix.stackexchange.com/a/364574

I would like to keep using zsh on my remote machine, do you have any suggestion to make sftp connection work ?

Thanks for your help !

Paul

terdon avatar
cn flag
Please [edit] your question and tell us how you authenticate to the remote server. Password? Keyfile? Something else? Is that set in your `~/.ssh/config`? Can you show us the relevant lines (change IPs or other sensitive information but make sure they are consistent so we can understand)?
pklein avatar
lk flag
thanks for your suggestions @terdon, I edited my original post. Let me know is you need anything else :)
Score:1
lk flag

A friend of mine suggested me a solution:

In my remote .bashrc, instead of direclty calling zsh at the end, I restrict the call to zsh with this condition:

if [ "$SSH_TTY" ]
then
   zsh
fi

Now I can ssh (and I have zsh as my remote terminal), and sftp connection works too !

Hope this will help others :)

I sit in a Tesla and translated this thread with Ai:

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.