O.K. That went well but then I ran into difficulties.
My “special scenario” is the following:
I don´t have a DSL router to which both the Lubuntu PC and android could connect at the same time. Lubuntu has its own mobile 4G-stick connection and android has its mobile connection. Both are separate from each other of course.
So the prerequisite “both devices have to be on the same network” can´t be fulfilled.
Hmm, then I tried the following: I created a hotspot on Lubuntu: I.e. Lubuntu is connected to the internet via the 4G-stick stick but provides a hotspot via a wlan dongle.
This works well, as I can connect the smartphone to the hotspot this way (de-activating its mobile connection first) and can thus access the internet on the phone.
But I guess this isn´t the same as “both devices being on the same network”, right
Neither does android see Lubuntu via the “KDE connect” app nor does Lubntu see the phone.
Hmm, I´m a bit stuck here. Is there any other way of getting Lubuntu and android to exchange files wirelessly?
I dont know what phone you have, but some can do “near device scanning”
where each device will ask for permission to download or upload stuff, and away you go
Hi Rosika,
There are a number of apps ( including Termux) that will make your mobile phone an ssh client.
There are also some apps that will setup ftp.
I installed it with pk in openssh and some basic settings were taken care of automatically, it seems.
So I did not not do the command ssh-keygen -b 4096 -t rsa as suggested.
Still I could not connect to my main PC.
I tried ssh rosika@[Public_IP_address_of_my_Lubuntu_PC] but it didn´t work.
Surely I´m doing something wrong here…
Hmm. Strangest thing:
Cannot ping my Lubuntu PC either.
From termux:
@Rosika Some routers and hot spots have an option called ‘client isolation’. So even though the PC and phone are on the same network they are isolated from each other on purpose. This is useful for a public hot spot or on a home router if you provide a second WiFi network for visitors to use that is isolated from your main WiFi network. Those on the visitor’s WiFi network are also isolated from each other.
Check to see if there is a setting like that in the hot spot.
Years ago (I’m talking like 10 or something) I used to use something called AirDroid I think - basically ran a web server on the phone that let you upload or download files… From memory the “free” version had limits on how much data you could copy back and forth - if you wanted more - you had to pay…
I think there was also a Samsung product that did similar called Samsung Kies…
I mostly used AirDroid 'cause the early implementations of MTP over USB were BROKEN on Linux - so I’d use AirDroid to get round that…
I mostly use adb-sync (its like rsync) over USB these days - it does have a wireless “version” but I’ve never been able to get that to work.
There’s also TermUX - i.e. you can scp / sftp and even rsync - i.e. either
run sshd within termux (note - it doesn’t use port 22 - uses 8022
in termux, using the shell / CLI run scp or rsync to push, or pull, data
I tried to replicate what you have. Can not get openssh to install in Termux. Some issue with repositaries. My termux can ping the modem, so ping works in Termux.
UPDATE
Fixed the ssh install issue
Setup WiFi hotspot in my PC
Shifted my tablet from modem WiFi to PC WiFi
Can ping the PC from Termux
My ssh in Termux fails, but I can use ftp
$
$
$ ssh trinity
CANNOT LINK EXECUTABLE "ssh": library "libcrypto.so.3" not found
Aborted
$ ftp trinity
Connected to trinity.
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 16:11. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Name (trinity:u0_a302): nevj
331 User nevj OK. Password required
Password:
230 OK. Current directory is /home/nevj
ftp> bye
221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
221 Logout.
$
Not sure what is going on with ssh, but i cant find libcrypto anywhere.
I can reach the internet from Termux thru the PC WiFi link.
FURTHER UPDATE
ssh is ok now in Termux. I needed the package openssh-tool
I think @Rosika 's ping problem is probably due to a firewall in the PC not allowing an incoming connection.
I forgot to mention - to be able to see the “stuff” in your TermUX folders - you probably need to run “termux-setup-storage”…
Because I have to run the somewhat shonky older version of Termux from the Play Store, 'cause my handset is CRIPPLED by Knox, I can’t directly access the SD-Card from inside TermUX - I think with the FDroid one, you can… unable to confirm or deny as Samdung’s crippleware prevents me using F-Droid (or installing apps from F-Droid, I was able to install it as an APK using adb).
I didn’t read the complete discussion but I think an easy way should be to use to install Warpinator and connecting your devices via the same wlan. In my case it worked perfectly.
Welcome @rodolfo_81825 ,
I have tried Warpinator. It worked for be too, but my trial was with bluetooth, not Wifi. It should work with any type of connection.
Regards
Neville
Thanks for the explanation referring to “client isolation”. Didn´t know that.
I checked. There seems to be nothing of the kind with me.
Never mind. But there´s still the issue of not being able to ping my PC…
Well, that´s not the case with me either. No same network, as my android phone and my Lubuntu PC are connected to the internet via their own mobile connection…
Never heard of airdroid before. Thanks for mentioning it. I´ll take a look at it.
That´d be my favourite of course. But I can´t get either ping or ssh working on termux.
I even switched off the firewall on Lubuntu to see whether it had any effect on the outcome.
Well, it didn´t.
sshd is running in temrux; so that can´t be it.
Thanks. I already did that after installing termux.
Thanks for the suggestion. I´ll look up warpinator.
But the “same network” will surely be a stumbling block for me.
Well, if everything fails I think I could still send files as an e-mail attachment to myself and thus get mp3 or picture files from one device to another.
However they can´t be too large in size for that to work…
So, assuming you are trying to connect “remotely”, you will need to make sure you can ping your intranet node.
You will most likely need to set up a remote access system on your PC.
By default (and design?) sshd doesn’t run on port 22 in TermUX - on my handset it runs on 8022… I can’t remember if I set that manually somewhere - but - given I removed it once, tried to install via F-Droid, didn’t work, re-installed, it was a fresh “Vanilla” install - so I’m guessing 8022 is the default in TermUX.
Here’s the stanza from my ~/.ssh/config :
Host homedung dunghome
Hostname x.x.x.x
User u0_a206
Port 8022
It always gets the same IP (i.e. what would normally be in x.x.x.x) - I’ve got a fixed IP DHCP lease setup in my router… and it doesn’t present itself over avahi / bonjour / zeroconf - so I was having to find out my phone’s IP address, then editing my ~/.ssh/config - that got tired very quickly…
Note also : I’ve NEVER had to tweak any localhost firewall doohickeys - not on 22.04 or 22.10 or MacOS… it just “works”… …
✅ Desktop Ubuntu 22.04 SSH to port 8022 on my Galaxy
✅ Laptop Ubuntu 22.10 SSH to port 8022 on my Galaxy
✅ MacBook Pro M1 MacOS 12.6 SSH to port 8022 " " "
✅ ditto
✅ Raspberry Pi4 Debian 10 : ssh to phone
✅ Raspberry Pi3 Debian 9 : ssh to phone
I also turned off the firewall on Lubuntu (otherwise it wouldn´t work)
now ssh-ing into Lubuntu works.
Quite and eerie experience to be able to run programmes on the smartphone that aren´t even installed here.
Well, course they run on Lubuntu (my fish history in Lubuntu tells me what I have done on android).
But it seems like doing stuff on android…
So - as next step - I´ll have to find out how to transfer files…
As you’ve got ssh client working - you can just pull using scp, or even rsync over ssh… You’ve already said you’ve run termux-setup-storage - you should be able to see data in your Termux folders, from elsewhere on your phone…
e.g. on your Lubuntu machine … well - here’s me in ZSH on my Ubuntu 22.04 desktop :
I’ve got two entries for my phone in ~/.ssh/config (it’s actually ~/.ssh/home and reference as an include in my ssh config) - the “homedung” entry uses the fixed DHCP lease IP address it gets over WiFi from my router :
╭─x@titan ~
╰─➤ grep -A 4 homedung .ssh/home
Host homedung dunghome
Hostname RE.DAC.T.ED
User u0_a206
Port 8022
Don’t need to even specify that it’s SSH - rsync does that automagically :
╭─x@titan ~/ResilioSync/Music/Rammstein
╰─➤ pwd
/home/x/ResilioSync/Music/Rammstein
╭─x@titan ~/ResilioSync/Music/Rammstein
╰─➤ ls -al
total 36
drwxrwxr-x 9 x x 4096 Dec 16 13:39 .
drwxrwxr-x 90 x x 4096 Dec 29 08:55 ..
drwxrwxr-x 3 x x 4096 Dec 15 15:54 1995-Herzeleid-FLAC
drwxrwxr-x 4 x x 4096 Dec 16 13:42 1997-Sehnsucht-JAP-FLAC
drwxrwxr-x 4 x x 4096 Dec 27 16:44 2001-Mutter-JAP-FLAC
drwxrwxr-x 6 x x 4096 Dec 16 13:46 2004-ReiseReise-JAP-FLAC
drwxrwxr-x 4 x x 4096 Dec 16 13:43 2005-Rosenrot-JAP-FLAC
drwxrwxr-x 2 x x 4096 Dec 15 15:53 2019-RAMMSTEIN-FLAC
drwxrwxr-x 2 x x 4096 Dec 15 15:53 2022-Zeit-FLAC
╭─x@titan ~/ResilioSync/Music/Rammstein
╰─➤ rsync -av ./1995-Herzeleid-FLAC homedung:~/storage/music/Rammstein/.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ED25519 key sent by the remote host is
SHA256:/SfOPQhONMpesZglCv5/eM+W/PJCgu12QlyuLwpKOjY.
Please contact your system administrator.
Add correct host key in /home/x/.ssh/known_hosts to get rid of this message.
Offending ED25519 key in /home/x/.ssh/known_hosts:86
remove with:
ssh-keygen -f "/home/x/.ssh/known_hosts" -R "[REDACTED]:8022"
Password authentication is disabled to avoid man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.
X11 forwarding is disabled to avoid man-in-the-middle attacks.
UpdateHostkeys is disabled because the host key is not trusted.
sending incremental file list
1995-Herzeleid-FLAC/
1995-Herzeleid-FLAC/00-pregap.flac
1995-Herzeleid-FLAC/01-Wollt ihr das bett in flammen sehen.flac
1995-Herzeleid-FLAC/02-Der meister.flac
1995-Herzeleid-FLAC/03-Weisses fleisch.flac
1995-Herzeleid-FLAC/04-Asche zu asche.flac
1995-Herzeleid-FLAC/05-Seemann.flac
1995-Herzeleid-FLAC/06-Du riechst so gut.flac
1995-Herzeleid-FLAC/07-Das alte leid.flac
1995-Herzeleid-FLAC/08-Heirate mich.flac
1995-Herzeleid-FLAC/09-Herzeleid.flac
1995-Herzeleid-FLAC/10-Laichzeit.flac
1995-Herzeleid-FLAC/11-Rammstein.flac
1995-Herzeleid-FLAC/Rammstein - Herzeleid.cue
1995-Herzeleid-FLAC/Rammstein - Herzeleid.flac
1995-Herzeleid-FLAC/Rammstein - Herzeleid.log
1995-Herzeleid-FLAC/Covers/
1995-Herzeleid-FLAC/Covers/1.jpg
1995-Herzeleid-FLAC/Covers/2.jpg
1995-Herzeleid-FLAC/Covers/3.jpg
1995-Herzeleid-FLAC/Covers/4.jpg
1995-Herzeleid-FLAC/Covers/5.jpg
1995-Herzeleid-FLAC/Covers/6.jpg
1995-Herzeleid-FLAC/Covers/7.jpg
1995-Herzeleid-FLAC/Covers/8.jpg
1995-Herzeleid-FLAC/Covers/Back.jpg
1995-Herzeleid-FLAC/Covers/CD.jpg
sent 879,701,295 bytes received 507 bytes 11,499,369.96 bytes/sec
total size is 879,484,810 speedup is 1.00
Edit: note - above is “push” to the phone from my Linux PC as source… I tried the reverse of this and got an error :
╭─u0_a416@localhost ~/storage/music/Rammstein
╰─➤ rsync -av titan:~/ResilioSync/Music/Rammstein/1995-Herzeleid-FLAC . 255 ↵
ssh: Could not resolve hostname titan: No address associated with hostname
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(231) [Receiver=3.2.7]
Edit 2 : that was eventually fixed by me tweaking my ssh client config files in ~/.ssh/ - and had to use the IP address of the machine titan… Note - PULL “rsync” is MUCH MUCH slower than push!
This isn’t a showstopper for me - I prefer to use USB to transfer files anyway… So I won’t research that error further…
BTW - I ignore all those boring messages about a man in the middle attack - I’m also lazy - 'cause the fix is right there in the output :
╭─u0_a416@localhost ~
╰─➤ cd storage/music/Rammstein
╭─u0_a416@localhost ~/storage/music/Rammstein
╰─➤ ls -al
total 12
drwxrwx--- 3 root everybody 4096 Dec 30 08:57 .
drwxrwx--- 4 root everybody 4096 Dec 16 15:46 ..
drwxrwx--- 3 root everybody 4096 Dec 15 15:54 1995-Herzeleid-FLAC
╭─u0_a416@localhost ~/storage/music/Rammstein
╰─➤ ls -al 1995-Herzeleid-FLAC
total 736496
drwxrwx--- 3 root everybody 4096 Dec 15 15:54 .
drwxrwx--- 3 root everybody 4096 Dec 30 08:57 ..
-rw-rw---- 1 root everybody 17501 Dec 15 15:44 00-pregap.flac
-rw-rw---- 1 root everybody 41562409 Dec 15 15:44 '01-Wollt ihr das bett in flammen sehen.flac'
-rw-rw---- 1 root everybody 32127508 Dec 15 15:44 '02-Der meister.flac'
-rw-rw---- 1 root everybody 27560000 Dec 15 15:44 '03-Weisses fleisch.flac'
-rw-rw---- 1 root everybody 30243405 Dec 15 15:44 '04-Asche zu asche.flac'
-rw-rw---- 1 root everybody 33481849 Dec 15 15:45 05-Seemann.flac
-rw-rw---- 1 root everybody 38316971 Dec 15 15:45 '06-Du riechst so gut.flac'
-rw-rw---- 1 root everybody 44436010 Dec 15 15:45 '07-Das alte leid.flac'
-rw-rw---- 1 root everybody 34834440 Dec 15 15:45 '08-Heirate mich.flac'
-rw-rw---- 1 root everybody 28471071 Dec 15 15:45 09-Herzeleid.flac
-rw-rw---- 1 root everybody 33566900 Dec 15 15:45 10-Laichzeit.flac
-rw-rw---- 1 root everybody 32708759 Dec 15 15:45 11-Rammstein.flac
drwxrwx--- 2 root everybody 4096 Dec 15 15:54 Covers
-rw-rw---- 1 root everybody 1128 Dec 15 15:44 'Rammstein - Herzeleid.cue'
-rw-rw---- 1 root everybody 376781078 Dec 15 15:44 'Rammstein - Herzeleid.flac'
-rw-rw---- 1 root everybody 2626 Dec 15 15:44 'Rammstein - Herzeleid.log'
And - I can use my main music player - Android app “Music Folder Player Full” (as opposed to the “free” version) to browse to that folder and play content from it - like Rammstein.
Mostly I don’t need to do that - because mostly I use a shell script that runs “adb-sync” to sync my main phone Music collection folders, with my ResilioSync/Music share on my computes…
Because my phone’s not rooted, I can’t use TermUX to do stuff directly on the SD-Card… So - those ~/storage folders in TermUX are on the phone’s internal storage…
You might also like to investigate using adb-sync :
And if you have any luck using the “WiFi” version “ADB Channel” - let us know - because I’ve had ZERO success with it - but that’s not a show stopper for me - 'cause I mostly have my phone USB C connector rigged up to my Linux computer when I’m at home, or my work MacBook when I’m at the office.
O.K… I still have to do that. But I guess it could be achieved.
Thanks. I´ll try that.
I just remembered I used to employ the sftp command when transferring files from or to running instances of my virtual machines (e.g. Debian).
So as a first step I tried this command within termux as well. And indeed it worked.
With sftp rosika@192.168.8.100 (issued from within termux) I established a connection to Lubuntu and then could retrieve a text file from Lubuntu with get [text-file]
I then exited the sftp connection (bye or just exit are fine for that matter) and then checked in termux with ll . And indeeed the respective text-file was there and I could read it with cat.
So that´s been successful so far. Nevertheless I´ll look into scp and rsync as well.
Ah, that´s good to know. Thanks, Dan.
I once tried to play an mp.3 file which came with the phone. It wouldn´t work.
If I remenber correctly there was a message trying to get me to do something with Google Play beforehand. I flatly refused.
I still could play the mp3 file from within termux
play [music-file].mp3
Thanks for the link. I will look it up.
BTW:
quite an impressive music collection you have there…
Thanks a lot for your help, Dan.
Many greetings and a healthy start into the New Year.
I use KDE Connect for a bunch of things. I just replied to an MMS by typing a long reply on my PC and hitting reply. I clean pictures off my phone by sharing to my PC. It does lots of other tricks. I use wifi which was easy to set up.
I guess I missed the part where you couldn’t run both devices on one network. If your PC connects through a modem, hook up a wifi router you get at a garage sale for two bucks.