gnome-shell-extension-gsconnect icon indicating copy to clipboard operation
gnome-shell-extension-gsconnect copied to clipboard

SFTP: Device does not mount

Open DezValT1r opened this issue 3 years ago • 90 comments

⚠️ Please Read ⚠️

Summary: The Android App uses a deprecated ssh-rsa host key (upstream issue)

Workaround: Add an exception to ssh_config (instructions)

Describe the bug

Android devices can not be mounted or browsed via SFTP.

Steps To Reproduce:

Try to mount an Android device using the menu item.

Expected behavior

Device should mount and open in Nautilus.

Support Log

ноя 09 21:21:08 gjs[5495]: JS ERROR: SM-A415F: Gio.IOErrorEnum: Сбой подключения _handleMount/</<@/home/dez/.local/share/gnome-shell/extensions/[email protected]/service/plugins/sftp.js:253:38 @/home/dez/.local/share/gnome-shell/extensions/[email protected]/service/daemon.js:727:17 ноя 09 21:21:08 org.gnome.Shell.Extensions.GSConnect[5495]: [/service/device.js:sendPacket:446]: SM-A415F: { "id": 1636482068837, "type": "kdeconnect.sftp.request", "body": { "startBrowsing": true } } ноя 09 21:21:08 org.gnome.Shell.Extensions.GSConnect[5495]: [/service/device.js:_readLoop:338]: SM-A415F: { "id": 1636482067836, "type": "kdeconnect.sftp", "body": { "ip": "192.168.1.2", "port": 1741, "user": "kdeconnect", "password": "hc1FPbfO0dQ2OwDiUVEb06C3R0jx", "path": "/", "multiPaths": [ "/primary" ], "pathNames": [ "primary" ] } } ноя 09 21:21:09 gjs[5495]: JS ERROR: SM-A415F: Gio.IOErrorEnum: Сбой подключения _handleMount/</<@/home/dez/.local/share/gnome-shell/extensions/[email protected]/service/plugins/sftp.js:253:38 @/home/dez/.local/share/gnome-shell/extensions/[email protected]/service/daemon.js:727:17


System Details (please complete the following information):

  • GSConnect version: 47
    • Installed from: [e.g. GNOME Extensions Website, GitHub, Package Manager, ...]
  • GNOME/Shell version: 40,5
  • Distro/Release: System: Host: gar-pc Kernel: 5.14.16-zen1-1-zen x86_64 bits: 64 Desktop: GNOME 40.5 Distro: Garuda Linux

GSConnect environment (if applicable):

  • Paired Device(s): samsung a41
  • KDE Connect app version: 1.17.0
  • Plugin(s): [if the issue only occurs when using certain plugin(s)]

Additional Notes:

Add any additional information about the problem or your system.

DezValT1r avatar Nov 09 '21 18:11 DezValT1r

Here is my log file. Looks pretty similar.
gsconnect.log

abhaypatil2000 avatar Nov 12 '21 19:11 abhaypatil2000

If the connection is just outright failing, it's probably a network configuration error. Anything else there should be a real error, indicating why the connection failed.

GSConnect should only try to wipe old host keys if the connection fails with a host key error (ie. old host key), so to then find that the file doesn't exist at all seems like this is probably a configuration problem with your distribution.

I'm not familiar with Garuda Linux at all, so I'm not sure I can help much more than that, sorry.

andyholmes avatar Nov 13 '21 04:11 andyholmes

Same issue: Gio.IOErrorEnum: Connection failed. Arch, gnome 41.1, Samsung S20+, App 1.17.0 I don't how to get detailed information

Noobsai avatar Nov 13 '21 11:11 Noobsai

My distribution has been updated to gnome 41.1, I have removed gsconnect on PC and KDE_connect on phone. Installed it again and paired it. But the mounting did not work. I installed Garuda KDE and Manjaro KDE on the same computer - this function works fine there.

DezValT1r avatar Nov 13 '21 12:11 DezValT1r

Вот мой лог-файл. Выглядит очень похоже. gsconnect.log

is mounting working for you?

DezValT1r avatar Nov 13 '21 12:11 DezValT1r

If the connection is just outright failing, it's probably a network configuration error. Anything else there should be a real error, indicating why the connection failed.

GSConnect should only try to wipe old host keys if the connection fails with a host key error (ie. old host key), so to then find that the file doesn't exist at all seems like this is probably a configuration problem with your distribution.

I'm not familiar with Garuda Linux at all, so I'm not sure I can help much more than that, sorry.

Earlier it worked on arch linux. When I installed another arch linux image on a different partition, it stopped working. Unfortunately I am unable to access the older arch linux installation, so can't comment whether it still works or not.

abhaypatil2000 avatar Nov 14 '21 13:11 abhaypatil2000

I tried to connect to SFTP via command line sftp -P 1740 [email protected] or ssh [email protected] -p 1740

Unable to negotiate with 192.168.88.245 port 1740: no matching host key type found. Their offer: ssh-rsa
Connection closed.  
Connection closed

I found a solution after some searching: Add to the ~/.ssh/config this lines:

Host 192.168.*.*
  HostKeyAlgorithms +ssh-rsa

After that the mounting works again.

Update 1: I have openssh 8.8p1 which has disabled the ssh-rsa. https://www.openssh.com/txt/release-8.7

OpenSSH will disable the ssh-rsa signature scheme by default in the
next release.

Update 2: Related bug for KDE Connect Android app Bug 443155 kdeconnect breaks when openssh is upgraded to version 8.8p1-1

Noobsai avatar Nov 20 '21 10:11 Noobsai

Thank you @Noobsai This works!

doppelhelix avatar Nov 20 '21 11:11 doppelhelix

I found a solution after some searching: Add to the ~/.ssh/config this lines:

Host 192.168.88.*
  HostKeyAlgorithms +ssh-rsa

After that the mounting works again.

Yeah this works

abhaypatil2000 avatar Nov 20 '21 18:11 abhaypatil2000

I tried to connect to SFTP via command line sftp -P 1740 [email protected] or ssh [email protected] -p 1740

Unable to negotiate with 192.168.88.245 port 1740: no matching host key type found. Their offer: ssh-rsa
Connection closed.  
Connection closed

I found a solution after some searching: Add to the ~/.ssh/config this lines:

Host 192.168.88.*
  HostKeyAlgorithms +ssh-rsa

After that the mounting works again.

Update 1: I have openssh 8.8p1 which has disabled the ssh-rsa. https://www.openssh.com/txt/release-8.7

OpenSSH will disable the ssh-rsa signature scheme by default in the
next release.

Update 2: Related bug for KDE Connect Android app Bug 443155 kdeconnect breaks when openssh is upgraded to version 8.8p1-1

Thank you very much for your research! Hooray, the mounting is working again!

DezValT1r avatar Nov 21 '21 08:11 DezValT1r

Didn't work for me. I created the config file and added the lines but still can't mount.

canbeardig avatar Nov 22 '21 23:11 canbeardig

Didn't work for me. I created the config file and added the lines but still can't mount.

No need to create a config file, I just added this: Host 192.168.x.x HostKeyAlgorithms +ssh-rsa to an existing file, which is located here: /etc/ssh/ssh_config

DezValT1r avatar Nov 23 '21 03:11 DezValT1r

Didn't work for me. I created the config file and added the lines but still can't mount.

No need to create a config file, I just added this: Host 192.168.x.x HostKeyAlgorithms +ssh-rsa to an existing file, which is located here: /etc/ssh/ssh_config

By looking at the original solution, I thought I was supposed to edit or create a config file in the home directory. But I did what you suggested and now it works. Thanks a lot.

canbeardig avatar Nov 23 '21 03:11 canbeardig

I'm not super knowledgeable about this stuff, but I've tried both versions of the solution in this thread, neither have worked for me. i am having the exact same issue. I even figured maybe the host part was supposed to be my IP, so i tried changing it to that, I've tried all four versions (the two above with the original text and with my ip) in the bottom and the towards the top of the config file.

basically, I've tried every version of the solution given i could think of based on my little knowledge gained from playing around with linux this past month. But i haven't been able to fix it, i'm sure i'm just missing something that is probably really obvious to more knowledgeable people. so some help would be much appreciated.

i'm using gnome 41.1 on Manjaro linux 86x_64, openssh8.8p1-1, and gsconnect 48-1

DanMeadWasTaken avatar Dec 11 '21 02:12 DanMeadWasTaken

The host is the remote host, in this case I would assume your Android phone.

Unless you're worried about someone sneaking a supercomputer onto your LAN I would just use a glob pattern like 192.168.0.* or whatever your subnet is. Picking a specific IP will be problematic if you're letting DHCP choose your IPs for you.

Like a lot of software, ssh will check in order the user configuration (~/.ssh/config) then the system configuration (/etc/ssh/ssh_config). You should probably only pick one to add the exception to, so as to avoid any possible conflicts. Personally, I would choose the user configuration file, even though you may have to create it and logout/login for it to take effect. It's up to you though.

andyholmes avatar Dec 11 '21 03:12 andyholmes

okay, this makes some more sense. So, i had actually tried just searching for the user configuration, but i could find no such file, although i did find the system configuration, and thus had been just adding it to that. Do you possibly have a link to how to find my subnet in the case that the glob pattern doesn't work?

So, probably a stupid question then, but i'm guessing based off past experience that the .ssh folder is supposed to be within the home directory? and if so, if it's not present, should i create the folder then put the config inside? And if it's not supposed to be there, where would i find it? Again, really new to this stuff, I've actually had a lot of fun figuring out Linux, but there are still a lot of things i do not know.

DanMeadWasTaken avatar Dec 11 '21 03:12 DanMeadWasTaken

okay, this makes some more sense. So, i had actually tried just searching for the user configuration, but i could find no such file, although i did find the system configuration, and thus had been just adding it to that. Do you possibly have a link to how to find my subnet in the case that the glob pattern doesn't work?

So, probably a stupid question then, but i'm guessing based off past experience that the .ssh folder is supposed to be within the home directory? and if so, if it's not present, should i create the folder then put the config inside? And if it's not supposed to be there, where would i find it? Again, really new to this stuff, I've actually had a lot of fun figuring out Linux, but there are still a lot of things i do not know.

The config file didn't exist in my home directory. But adding these lines to /etc/ssh/ssh_config did solve the problem:

Host 192.168.*.* HostKeyAlgorithms +ssh-rsa

Screenshot from 2021-12-11 07-23-32

canbeardig avatar Dec 11 '21 04:12 canbeardig

alright, now a new stupid question... honestly i figured out why i wasn't seeing the other file, it was because i was searching from within something else. so now i did find the etc/ssh/ssh_config vs whatever i was apparently changing before with the same name... now then, how do i use root to add the bit to it? as i have tried to just access root then cd into it, but it keeps tell me the directory doesn't exist

at this point, i'd love it if someone told me step by step... I've done similar stuff before, but those files were a bit easier to find and had a step-by-step guide on how to do it. So treat me like i'm five, just as long as it makes some sense to someone who knows next to nothing

EDIT: to explain the multiple files part, it turns out i was searching from home - which was giving me 2 files within the flatpack folder, which has the same exact text as the one within the /etc/ssh/ folder. but those two did nothing when changed, and I've not much of an idea of how to edit the /etc/ssh/ssh_config one, which seems to be the one i need to edit

DanMeadWasTaken avatar Dec 11 '21 04:12 DanMeadWasTaken

scratch that, a quick google search told me how to edit files as root, thankyou guys though! wish i'd known about gedit before... i wouldn't have had to manually count 123 lines of code that one time for ani-cli

DanMeadWasTaken avatar Dec 11 '21 04:12 DanMeadWasTaken

alright, now a new stupid question... honestly i figured out why i wasn't seeing the other file, it was because i was searching from within something else. so now i did find the etc/ssh/ssh_config vs whatever i was apparently changing before with the same name... now then, how do i use root to add the bit to it? as i have tried to just access root then cd into it, but it keeps tell me the directory doesn't exist

at this point, i'd love it if someone told me step by step... I've done similar stuff before, but those files were a bit easier to find and had a step-by-step guide on how to do it. So treat me like i'm five, just as long as it makes some sense to someone who knows next to nothing

You can right click and Edit as Root/Administrator. Enter your password, open the file, add the lines and save. Not Save As though just Save.

canbeardig avatar Dec 11 '21 04:12 canbeardig

i know this is a bit innapropriate to waste space on, but you wouldn't be able to imagine the yell of happiness and the fist pump i just did into the air at finally getting this working.... i've tried other things for accessing my files on android, of which didn't work, so working on this for days... earlier found out that since my pc was plugged into the modem and not the router, they were on different networks... felt like an idiot... now to find out i was editing the wrong file for the past, like 6 or so hours.... god i am so happy to have this working

DanMeadWasTaken avatar Dec 11 '21 04:12 DanMeadWasTaken

For your future reference the tilde (~) is a "shell expansion" that the shell/terminal will automatically replace with the home directory for the current user (ie. ~/foo will expand to /home/username/foo). It's pretty common for people to just use ~/something to refer to the home directory even when they're not talking about shell commands.

andyholmes avatar Dec 11 '21 05:12 andyholmes

I tried to connect to SFTP via command line sftp -P 1740 [email protected] or ssh [email protected] -p 1740

Unable to negotiate with 192.168.88.245 port 1740: no matching host key type found. Their offer: ssh-rsa
Connection closed.  
Connection closed

I found a solution after some searching: Add to the ~/.ssh/config this lines:

Host 192.168.88.*
  HostKeyAlgorithms +ssh-rsa

After that the mounting works again.

Update 1: I have openssh 8.8p1 which has disabled the ssh-rsa. https://www.openssh.com/txt/release-8.7

OpenSSH will disable the ssh-rsa signature scheme by default in the
next release.

Update 2: Related bug for KDE Connect Android app Bug 443155 kdeconnect breaks when openssh is upgraded to version 8.8p1-1

It doesn't work for me, I have the following error

imagen

ericktucto avatar Jan 25 '22 02:01 ericktucto

the ip of my cell phone was 192.168.0.15, for that reason it did not work for me, to know the ip of your cell phone it is necessary to go to the settings and look for the IP address option

ericktucto avatar Jan 25 '22 02:01 ericktucto

Ignore this message ... I just had to allow permissions in the KDE Connect app on my tablet

raffaem avatar Feb 16 '22 18:02 raffaem

I tried to connect to SFTP via command line sftp -P 1740 [email protected] or ssh [email protected] -p 1740

Unable to negotiate with 192.168.88.245 port 1740: no matching host key type found. Their offer: ssh-rsa
Connection closed.  
Connection closed

I found a solution after some searching: Add to the ~/.ssh/config this lines:

Host 192.168.88.*
  HostKeyAlgorithms +ssh-rsa

After that the mounting works again.

Update 1: I have openssh 8.8p1 which has disabled the ssh-rsa. https://www.openssh.com/txt/release-8.7

OpenSSH will disable the ssh-rsa signature scheme by default in the
next release.

Update 2: Related bug for KDE Connect Android app Bug 443155 kdeconnect breaks when openssh is upgraded to version 8.8p1-1

Great hint! Worked also for me after Fedora 36 upgrade. Thanks a lot for sharing! ;) But don't forget to set permissions for ~/.ssh/config to 600

jwich71 avatar Jun 12 '22 08:06 jwich71

The problem is back again, the previously used method does not work. Any ideas? Kernel: 5.18.5-zen1-1-zen arch: x86_64 bits: 64 Desktop: GNOME v: 42.2 Distro: Garuda Linux sudo pamac info openssh name : openssh version : 9.0p1-1

DezValT1r avatar Jun 19 '22 14:06 DezValT1r

I went through this with a bunch of senseless reboots. Running openssh 9.0p1-1

In /etc/ssh/ssh_config I have

Host 192.168.1.*
  HostKeyAlgorithms +ssh-rsa
  PubkeyAcceptedKeyTypes +ssh-rsa

sftp -P 1740 [email protected] should connect to the phone. Mine was connecting but gsconnect was not mounting. In the end it turned out I had to restart the phone.

daught1 avatar Jul 14 '22 18:07 daught1

Я прошел через это с кучей бессмысленных перезагрузок. Запуск openssh 9.0p1-1

В /etc/ssh/ssh_config у меня есть

Host 192.168.1.*
  HostKeyAlgorithms +ssh-rsa
  PubkeyAcceptedKeyTypes +ssh-rsa

sftp -P 1740 [email protected] следует подключиться к телефону. Мой подключался, но gsconnect не монтировался. В итоге оказалось, что мне пришлось перезагрузить телефон.

Indeed, it is working again. Previously, two lines were enough, but now three lines are needed

Host 192.168.. HostKeyAlgorithms +ssh-rsa PubkeyAcceptedKeyTypes +ssh-rsa Thank you very much!

DezValT1r avatar Aug 14 '22 08:08 DezValT1r

/etc/ssh/ssh_config

Host 192.168.. HostKeyAlgorithms +ssh-rsa PubkeyAcceptedKeyTypes +ssh-rsa

DezValT1r avatar Aug 14 '22 08:08 DezValT1r