This app was mentioned in 100 comments, with an average of 2.22 upvotes
All Android phones are Linux phones, in a broad and somewhat peculiar sense. Here's a shell session from my Android app SSHelper:
$ uname -a Linux localhost 3.18.71-13482624 #1 SMP PREEMPT Fri May 4 20:47:19 KST 2018 aarch64 Android
There are some serious limitations to Linux on Android, one being that you can't just create an ext4 partition to have normal filesystem behavior (a particular annoyance of mine). Android's default filesystem is a sort of tortured version of the Windows fat32 filesystem.
On the other hand, using one of the available Secure Shell servers as above, you can use Android as a sort of miniature Linux shell-session experience -- from another machine (Windows or Linux) running a terminal emulator.
There are also Linux emulator environments that seem more Linux-like than the above limited example, some of which ~~don't~~ DO require rooting the phone, like Linux Deploy, a relatively polished example.
EDIT: correction
Fair enough. If you want a shell session plus an SSH server with logon and file transfers on your Android phone, install my app SSHelper -- open source, free, no ads, no "get pro" BS.
> After much searching, I've come to the conclusion in order for me to have a linux distro fully installed on my phone, I need to create one from scratch.
Okay, let examine the premise. You want to create a Linux distribution that works on a phone.
> So my question is this, where is a good place to have access to information that may assist in my journey.
Well, you could install Linux and learn it to some depth, then try compiling kernels in different environments and processor types, see how that goes. Then you could cross-compile some applications for, say, Android, and test them using Android's resident Linux kernel.
But a full replacement of (just as an example) Android would require a deep understanding of the Android device's hardware and interfaces, storage protocols, infrastructure. For that, you would want to create a lot of Android applications that interact at a low level with the Android environment.
Then merge the two subprojects (Linux kernels and Android interfacing) into one.
A good immersion would be to download the Ubuntu Touch source:
How To Install Ubuntu Touch On Your Android Device
Ubuntu Touch is an abandoned project that had as it goal to do what you're trying to do. However ambitious, the Ubuntu project people found out how difficult this was to do, and they gave up.
One of the reasons they gave up was they discovered that every Android device is different and requires different approaches. This is something I also discovered in my much less ambitious project SSHelper, which is now a sort of SSH server / shell environment / utility tool. Because I use native-code binaries, I found out how many different quirks exist in the Android world and environment.
Anyway, I wish you the best of luck.
For God's sake, will you stop trolling? You're wasting people's time.
All Android apps that support Secure Shell and that don't require root access, use a port above 1024 -- each and every one of them, including mine.
All cases/apps/circumstances in which a Secure Shell server must operate at the user level (there are hundreds) cannot use port 22, and therefore must use a higher port. All prudent website operators who offer Secure Shell on a public-facing server use a nonstandard port. Which part of this self-evident ground truth is causing you the most confusion?
And the linked article is complete nonsense, click-bait with no substance.
> I need to be able to move files to and from(or at least to) a Linux mint 17.2 machine and multiple Linux mint and Android devices
Between Linux computers across the Internet or on the local network:
Set up Secure Shell servers and clients on both ends, i.e. OpenSSH.
Set up encryption keys.
Set up the client so it doesn't need to enter a password for the server:
$ ssh-copy-id username@server-name-or-ip
Configure the server so it rejects password logons -- edit /etc/ssh/sshd_config, disable password logons.
Open port 22 on the server's router, so you can access the server from the Internet. Do not do this until you have disabled password logons.
Now you can log onto the server from anywhere in the world with complete security. To transfer files from a source directory on the client to a dest directory on the server:
$ rsync -av /source-path/ server-name-or-ip:/dest-path/
Yes, it is as simple as that. Rsync can also be used for local backups - it only copies changed files. To completely synchronize the backup image, meaning delete any files on the server that are not on the client, add "--delete" to the rsync command line.
To transfer files from/to Android, install my Secure Shell app SSHelper. Free, open source, no ads, no "get pro" BS. SSHelper hosts shell sessions and allows all the usual Secure Shell modes (rsync, sftp, scp, etc.), and lets you browse your Android device from a Linux desktop with a file explorer. Just type this into the file explorer's address bar:
sftp://(Android device name or IP)/
I have the portable release, 7.8p1. This has been an issue for some time now -- lots of people would like to be able to compile OpenSSH for Android but the code base has a bunch of small errors that don't seem to affect x86 compilation (for some reason) but grind the process to a halt on an ARM cross-compiler.
It's very frustrating -- I have a well-known app called SSHelper that I would like to update, but editing the source, tracking down bugs and compiling OpenSSH for Android is a huge time-waster.
It's especially frustrating because OpenSSH is a really terrific project and set of tools. Apparently not enough people submit the source to a cross-compiler for this problem to be well-known.
Do some troubleshooting:
Check that the server is accessible: ping (IP)
Check that the SSH port is open: nmap (IP)
Check the details of the connection attempt: ssh -vvv (IP)
Make sure the server is listening on the port you think it is. My Android SSH server (SSHelper) uses port 2222, because it runs at the user level.
I can't tell from your post what combination of properties you're after, but my Android app SSHelper offers an SSH shell login and command-line session, as well as supporting bidirectional file transfers using SSH methods like scp, sftp and rsync. Free, no ads, no "get pro", open-source.
The answer is that you don't add commands/utilities to Busybox, you have to add them to the system that hosts Busybox. Busybox is not directly extendable as you're thinking -- it's a single, unified binary with a fixed number of functions whose steering is controlled by symlinks. If Busybox is called via a symlink with the name "ls" then Busybox knows to run its internal "ls" function.
How do I know this? My Android app SSHelper does this the same way. My app includes Busybox, and has some commands beyond what Busybox offers, but I do this by including separate binaries for those commands, not by trying to extend Busybox.
I can't speak for the internal configuration of Termux, but I do know it would in principle be easy to add commands to the existing set.
Why don't you ask Termux? Termux FAQ
It's also missing from the Play Store.
I wanted to recommend SSHelper, but sadly it has a farewell message at the top, with a link to its homepage with all of the details.
> Able to copy files from my phone to computer, but not vice-versa via MTP.
Do whatever you can to avoid MTP, it's not suitable for what you are doing, or any serious bidirectional file transfers for that matter.
There are many much better alternatives, including my own SSHelper (free, no ads, open-source), which uses a WiFi connection to serve Secure Shell connections and a much better way to transfer files. With SSHelper you can open a file browser on the Linux desktop and browse your Android phone's filesystem, dragging and dropping files and folders bidirectionally.
Use my app SSHelper. SSHelper is free, no ads, open source. It runs an SSH server, so you can transfer files using sftp. Once SSHelper is up and running, open a file explorer and type this into the address bar:
sftp://(device IP):2222/sdcard/
The file explorer will then show the Android's file system. Read, write, copy and so forth. This is way faster and more efficient than using a USB cable and MTP.
> I knew having consistent UIDs/GIDs was an option but I wanted to avoid having to rely on it as I have multiple machines in my family with different ids and I thought there was an easier way to map them without having to tinker every one of them.
The reason for the UID/GID approach is that these values are all numerical below the public names, and for security they all have to agree with each other.
> What is the purpose of all_squash and anongid if I have to map the ids anyway?
Don't know, but I'm suggesting that you not use NFS anyway. Secure Shell is a better choice, more secure, and way easier to set up. My Secure Shell tutorial: How to Use Secure Shell
> The idea was to allow everyone who comes to me to access all the public files easily from their phones, tablets etc
Unless they're running Linux, that eliminates NFS all by itself. On the other hand, most tablets and phones can be equipped with a way to interact with Secure Shell. My Android app SShelper (free, open source) is just one of several examples.
That's because Android doesn't let you write to the external storage device. You have options:
Take the card out of the Android device and write to it on a laptop/desktop.
Make Android "adopt" the card fully, so it appears as part of Android internal storage.
Run my Android app SSHelper and transfer files wirelessly (doesn't solve the external storage device problem except indirectly). My app is free and open-source.
These issues are discussed in depth in the SSHelper Home Page.
> I just don't know what app I could use on my pop bu one to open the text file since I havent thought of this before. I'll search around and thanks again.
To transfer the file to your Android device, use my Android app SSHelper. It's free, no ads, no "get pro" bullshit. Once it's installed, on Linux browse your Android device using a file explorer with this URL:
sftp://android-device-name/path/
To avoid having to specify the nonstandard SSH port my app must use (or another port of your choosing), add a file named "config" to your user .ssh directory with this content:
host (url or IP of Android device) port 2222
Then choose an Android app that can manage your text-file content and purpose.
You need to sideload a SSH server like this one: https://play.google.com/store/apps/details?id=com.arachnoid.sshelper
I'm using it since I own my Shield (2015) and it works great.
You can connect via SCP or command line (Usefull for hacking)
I found MTP totally unusable on my Debian Testing system.
However, this very day I have discovered the perfect solution.
Install SSHelper and add your desktop computer's public key to it.
Add the following lines to /etc/ssh/ssh_config
host halle port 2222 Compression yes
I had expected compression to slow things down given the limited power of my 'phone's CPU, but it makes a 6M file transfer in under 7 seconds as opposed to about 18 uncompressed.
(replace halle with your 'phone's hostname or IP address)
Then install SSHFS on your desktop. And it's as easy as
sshfs -o your_uid halle:/storage/emulated/legacy /media/androidcard
Where your uid is the uid of your userid on the Linux box, halle is the name of my Moto G (you'll need to use the IP address if it isn't in your hosts file), /storage/emulated/legacy is the path to my virtual SD card and /media/androidcard is the directory you want to mount it on.
As long as your userid has write permission for the mount directory, you don't need root to mount it. Unmount it using:
fusermount -u /media/androidcard
[edit] Added uid allocation to the mount command.
Do it this way:
Plug the phone into your computer using a USB cable.
The phone will appear in your file explorer, click the icon.
The phone will ask for permission to allow file transfers, reply in the affirmative.
Browse the phone's file system, go to DCIM and browse its contents (which I just did).
> I've managed to ssh into my phone by installing an app named simple-ssh
My free Android app SSHelper would have worked -- I use it more often than the above method, I only posted the above method because it's simpler to set up.
I was referring to the infrastructure and user applications. I have some Android apps at the Google play store, they're primarily Java with one notable exception (SSHelper) which uses a lot of native code and is a pain to maintain for that reason.
> Most apps still use native libraries outside of java.
This is quite false. Visit the primary development environments like Android Studio, see whether they manage native code without a big struggle. Not saying it can't be done, since I did it, but it's certainly not something that's desirable or recommended.
> Is there maybe an even simpler solution without adb?
Yes, there is, much simpler -- use my free Android app SSHelper, which accomplishes this wirelessly. With SSHelper you can use a host file explorer to browse the Android filesystem, move files, copy, back up and so forth.
SSHelper is free, no ads, not "get pro", and open source.
> Phone = Samsung S10e - Android 10
There it is. Android 10 is killing your process.
Over the years, newer Android versions have gotten more and more aggressive about killing processes that seemed to be hogging the CPU or using up battery power.
The remedies:
Enable developer mode and select "stay awake" mode.
Put your process in the list of apps that should not be interrupted.
If your process has no associated application, that's a problem. To solve this, install my free app SSHelper, put it on the list of apps that are allowed to function without interference, and perform the transfers wirelessly. That's easier in any case.
> So i can root the board (snapdragon 820 development board, which has Android Pie) and insert a device driver, right?
Yes, in principle. The process can at times be convoluted, but most Android devices allow it.
> The driver has to be written in C? Or Java?
Drivers, which interact with the kernel, must be written in a language able to interact with the kernel and hardware directly, which excludes Java. This is why my Android app SSHelper does everything important in native-code binaries instead of Java. There is a Java user interface but the program's essentials are written in C.
> I am trying to crosscompile ssh for my Pocketbook 3, but it seems, that I need a version of ssh, that uses libcrypto.so.1.0.0.
I apologize for changing the subject, but you do not want to use this SSL library -- it's vulnerable, it is no longer being maintained, it has known security flaws ... just don't use it.
OpenSSL 1.0.0 Deprecated : "Support for version 1.0.1 ended on 31st December 2016. Support for versions 0.9.8 and 1.0.0 ended on 31st December 2015. Those versions are no longer receiving security updates."
That's not even the whole story. Elsewhere are accounts describing the forced retirement of this version for its security flaws. In fact, Google told me I had to update the SSL library I use in my Android app SSHelper or they would bar it from the Play Store.
So ... don't do this. Think of a different way to get to your goal.
Again, I apologize for wandering off-topic.
The remedy is not to try to use MTP, it's very inefficient and flaky. Use my Android app SSHelper. SSHelper runs an SSH server accessible on the local network -- you can open a file explorer on your laptop/desktop and enter:
sftp://(Android device IP or name):2222/sdcard/
And you're browsing the Android device's filesystem -- copy, paste, drag & drop, all the usual file explorer functions. You can also use rsync, scp and others, or log into the Android device for a shell session.
SSHelper is free, open source, no ads, no "get pro" BS.
An x86 host can deliver a binary VM to a client that runs a different processor. There's no problem with that, because once running, the only connection between the server and client is the network, and the network itself is processor-impartial.
This is why my app SSHelper, running on an Android device, can perform detailed transactions with a server running any processor.
In fact, a server running processor A could communicate with machines running processors B, C etc. and deliver the right native-code VMs for each.
Several ways. I wrote a wireless method called SSHelper, open-source, free, no ads, uses Secure Shell.
With my app you can enter this in the address bar of a file browser:
sftp://android-device-name.local/path/
Assuming you have Avahi (Zeroconf) running, or:
sftp://android-device-IP/path/
If not. Then you can browse your device, upload, download and such.
You can also use my app to log into your Android device just as though it was a Linux server. Which it sort of is.
To connect from the Linux install to Android (not your original request), use my Android app SSHelper. It's free and open-source, no ads, no "get pro" annoyances. It provides all the expected SSH services plus a login session capability.
For the reverse case (Android to Linux), maybe you haven't started the SSH server on the Linux install. Try this:
$ sudo systemctl start sshd $ sudo systemctl enable sshd
To establish that there's an SSH server running:
$ nmap localhost
Look for port 22 open:
22/tcp open ssh
I develop Android applications using a mixture of languages -- example (SSHelper) -- so I create a framework in Android Studio and develop my native-code binaries outside the Android Studio environment.
The usefulness of Android Studio to your projects depends on the degree to which your applications are reliant on Android's ecosystem and how much on native-code binaries. But you will need to create an Android framework regardless, and Android Studio is useful for that.
> I started a openssh server in my Linux desktop.
Actually, most Linux distributions run this server by default. And a good thing, too -- SSH is a very useful utility for all sorts of things.
> Copy files from the server to my phone?
Certainly, and easy -- just use my free app SShelper as the SSH server on your phone. No rooting required.
> While copying iso file from my phone to the drive ... It only copied 175.1Mb...?
Yes, very familiar with this. Let me guess -- the device runs Android with a recent Android version installed. If so, the problem is that Android is aggressively killing your server to save battery power.
The solution to that is to tell Android to leave your application alone. Do it this way:
Access Settings ... Device Maintenance ...Battery ... Unmonitored Apps. Add the server app to the list of apps that aren't to be killed by Android.
I know this because I have a free Android app called SSHelper that suffers from this Android behavior when people try to use it for serious file transfers.
> Anyway, what is the best way to reliably copy files between linux and android devices?
Use my Android app SSHelper -- it supports all Secure Shell utilities including rsync. It's free, no "get pro" bullshit, there are no ads, and it's open-source.
Once your Android device has a wireless connection on your LAN and my app is running, you can open a file explorer and enter: sftp://android-device-name.local
to browse the Android device's file system.
Or, if you prefer, you can use rsync from the command line for larger transfers.
EDIT: clarification
> While copying iso file from my phone to the drive ... It only copied 175.1Mb...?
Yes, very familiar with this. Let me guess -- the device runs Android with a recent Android version installed. If so, the problem is that Android is aggressively killing your server to save battery power.
The solution to that is to tell Android to leave your application alone. Do it this way:
Access Settings ... Device Maintenance ...Battery ... Unmonitored Apps. Add the server app to the list of apps that aren't to be killed by Android.
I know this because I have a free Android app called SSHelper that suffers from this Android behavior when people try to use it for serious file transfers.
Most likely this isn't about Linux, it's an Android problem. Recent Android versions have begun to be very aggressive about closing applications it thinks are wasting CPU cycles or memory. This is just a guess about a high-probability cause.
> I can sometimes reproduce the error with ssh (not scp) by connecting to my phone and running a command that will produce a lot of data (e.g. dd if=/dev/urandom | base64).
So this just puts out random characters, then the connection dies, yes? That increases the likelihood that it's Android killing off the connection.
One remedy is to tell Android to leave the server app alone. Go to Settings ... Device Maintenance ... Battery ... Unmonitored Apps and select the server app, this will make Android keep hands off.
I know this because I have an Android SSH server app called SSHelper that does the same thing unless this configuration step is taken.
Again, this is just a guess. There are a number of other possibilities.
https://play.google.com/store/apps/details?id=com.arachnoid.sshelper&hl=en
You'll need a sftp/scp client on your PC, FileZilla works.
That's for connecting from the PC to the phone for the file transfer, if you want to go the other way there are similar solutions, but they are honestly more of a pain to setup.
This is possibly the most confusing post I have ever read. You mention Windows, Linux and Dropbear, WinSCP and servers for SFTP and SCP (which aren't really separate servers). Then you ask what options you have on Linux.
I would love to answer, but first you must ask a clear question.
Linux typically runs OpenSSH, which provides all the Secure Shell protocols, so if you try to make contact with a Linux machine so equipped, you will have any Secure Shell service you care to have.
I think Dropbear serves all these protocols as well, but it's been so long since I have tried to use it (and since I removed it from my Android SSH server program SSHelper) that I honestly don't remember. But I think it offers all the same protocols, so you should have SFTP, SCP, terminal sessions, and the ability to use rsync to synchronize filesystems.
One difference I recall between Dropbear and OpenSSH servers is that the former doesn't get along with a Secure Shell utility called "ssh-copy-id", which is one of the reasons I stopped supporting it in my programs.
As to your title, "Mounting/navigating remote filesystem using scp protocol?", that's not what SCP is for. That's what SFTP is for. To see what you can do with SFTP, enter this into a Linux file browser:
sftp://machine-name
Which, based on your post, it seems you already know about.
Most Linux file browsers will respond by showing a listing of all the directories and files on the remote system, and allow you to add, delete and rename directories and files, just as though the remote system was local.
> Ignoring the numbers of files, 16GB over 5 hours is fairly typical of consumer connections for upload. That's just over 7Mb/s.
Yes, but my theory is that the OP is transferring an archive that includes only a few changed files, and scanning and comparing directory trees would be much more efficient.
> Does Rsync compress files be default, or do you have to use the -z switch?
One must use the -z switch, but on some networks, it's faster to just transfer the uncompressed files rather than take the time to compress and uncompress. This is determined on a case-by-case basis.
> That should speed things up in addition to your method for skipping unchanged files.
It's not my method -- I admire the person who wrote rsync, but it wasn't me. I can explain how to use it efficiently, and I've written an app ( SSHelper) that extends its power to the Android platform. I think it's the most efficient directory synchronization method I have ever seen, and it's secure as well.
I can't help with item (1) because it's most likely a graphics issue, possibly hardware or driver related, something not easily sorted out from a distance.
Item (2) can be solved by installing a decent Unicode font with many more characters -- example Bitstream Cyberbit, a font I have used successfully. The basic idea is to have as complete a Unicode character set as possible.
As to item (3), I assume you're transferring files from your tablet by way of a USB connection or by Bluetooth. These should be fast in principle, but many things can go wrong. Have you tried SSHelper? It provides file transfers using the Secure Shell protocols through a Wifi connection, and it can be fast if set up correctly. It's free -- SSHelper. Full disclosure -- I'm the author of SSHelper.
> What needs to be done to help encourage cooperation between Free Android apps and Free desktop software?
I have one key idea that would really help -- an easy way to communicate between desktop/laptop machines and Android. The simplest solution would involve providing both OpenSSH and Zeroconf at the Android system level, always available, on all Android devices.
Several years ago I wrote a free Android app (SSHelper) that's a partial solution to this problem (it offers both OpenSSH and Zeroconf), but because it runs at the user level it's somewhat of a hack -- it would be much more effective at the system level where it belongs. Even though I wrote this app, I would drop it in an instant in favor of a system-level install of OpenSSH and Zeroconf, which together would really open Android up to the desktop.
Sometimes true, but for balance, here's my documentation page for SSHelper, my best-known free Android app. It runs to thousands of words and covers an enormous amount of detail.
I do something similar, but using the SSHelper app through USB tethering. It's very well made and GPL. Works much better than MTP since it actually works like a decent filesystem in the other end instead of the one op at once, have to replace the whole file slow crap that MTP does.
> Does my tablet have to be connected to the PC via USB, or can this be done over LAN?
Is it an Android tablet? If so, use my free program SSHelper, which allows you to use SFTP to communicate with your laptop./desktop environment.
The USB-cord method will work, but it's harder to set up to work reliably.
> I assume I could get the bash script to automate it?
Yes.
> Something like "check every two hours, and if (a) the tablet is connected and (b) the files have changed, sync silently and without prompting me to overwrite older files"
Not a very good idea. Scenario: you have just accidentally erased your magnum opus, on which your entire future depends, and (Murphy's Law) the script chooses that moment to obediently erase the backup copy as well.
Better to click a desktop shortcut when you're done creating/updating your work, as a conscious, deliberate act.
> It is possible to run dropbear or any other ssh server as unprivileged user?
Yes, but using a port number > 1024. There are many use cases where this is the best choice anyway, so it doesn't present an obstacle.
But some advice. For maximum usefulness and compatibility use OpenSSH, not Dropbear. Imagine you issue this command:
$ ssh-copy-id username@hostname
If the server is Dropbear, it won't know what to do and the operation will fail. If the server is OpenSSH, the operation will succeed. This is just one example. In my Android project SSHelper, in development I tried to get Dropbear to function correctly in an epic struggle. I finally gave up and used OpenSSH instead, simply because it maximized the number of operations people expect from an SSH server.
> So I've been trying to copy files with rsync after mounting my phone with simple-mtpfs.
Don't use that protocol. Use an SSH server on the phone. Mine is SSHelper, free, open-source, but there are several available.
Yeah, okay, that's a much more difficult problem that I realized. The wireless method might be easier -- use my free app SSHelper and access it from a Wine network connection.
Use my free Android app SSHelper. It runs an SSH server, so you can browse your phone using a Linux file explorer by entering this in its address bar:
sftp://[machine name or IP]:2222/sdcard/
Copy files to and from the phone.
No USB cord required, no ads, open source. The SSHelper Home Page
Use wireless for this, not the gvfs approach, which is a really terrible filesystem -- slow and unreliable.
My free app SSHelper is an SSH server that runs across a local WiFi connection, that you can use to back up your Android files to a laptop/desktop/whatever on the local network. Free, no ads, open source.
My free app SSHelper is an SSH server that runs on an Android device. It gives wireless connectivity and the ability to browse the Android device's file system using a Linux desktop file explorer, things like that.
Free, no ads, open-source.
Use my free app SSHelper. It's an SSH server that you can access from Linux like this:
Open a file explorer.
Enter this into the file explorer's address bar:
sftp://android-devicename-or-IP
Once you have set up my app and it has a wireless connection on your local network, the Linux file explorer can browse the Android file system using commands like the above, copy files bidirectionally and some (but not all) of the usual file activities.
There are some things that the Android filesystem won't allow, because of its primitive nature, but all the important ones are present.
SSHelper is free, there are no ads, no "get pro" BS, and it's open-source. Here's the SSHelper home page.
> Can i run Servers on Linux from an Android Phone?
Yes, I know because I do it all the time. My free app SSHelper does exactly this. Termux does this also, same way.
There are many other Android apps that do this, many of which have available source (mine does, and Termux as well -- both open source).
It's not obvious what the layout is, or your goal. If your computer is connected to your router, then you already have a network connection.
Are you trying to transfer files from your computer to your phone, or the reverse? If so, install my free app SSHelper, which I designed for just this purpose.
SSHelper is free, it is open source, there are no ads and no tricks.
> I'm using MiX File Explorer on my Android phone ...
Wait, earlier you said you were on an Xubuntu install, so is this about Xubuntu or Android's Linux version? Or is the point to transfer files from Android to (or from) a desktop Linux version? If the latter, use my free Android app SSHelper. Once this is installed on the Android device the instructions I posted earlier will work between the Android device and a desktop Linux version.
Oh, that is so annoying. I should have noticed that it was a paid program. Oh, well, even though I think Termux is a better environment for what you want to do, my free app SSHelper can provide the server function you need (and autostart at boot). It's easy to set up, in fact it more or less sets itself up, all you need to do is add a real password.
Termux should fill this bill if configured correctly. It will take some familiarization.
My free app SSHelper can do this too, but the truth is, Termux is a better app and environment. My app comes preconfigured for SSH file transfers, and Termux needs to be configured for SSH serving, but again, Termux is a more flexible environment and a deeper learning experience.
Correspondent u/Sw1ftyyy points out that Termux can be activated at boot with Termux:Boot.
My free app SSHelper shares a clipboard process between the Android device and a desktop/laptop. The desktop/laptop accesses the Android clipboard by way of a Web page generated by my app, which offers two-way access.
> Is is bad/can i break the system by installing in Linux Mint Mate another (one more ) file manager , just for basic file management , cuz i kinda don't like caja
No problem -- I always install Nemo, my personal favorite file manager, and it doesn't cause problems or interfere with other file managers. I'm sure this can be done with other file managers.
> Freezing when opening my Android's internal storage
I use my own free Android app SSHelper as an SSH server and I put this in my file explorer's address bar:
sftp://(ip or name)/android-path/
No issues, able to browse the Android filesystem from my laptop.
My free Android app SSHelper uses Secure Shell to make the Android device accessible to a desktop/laptop. Because of SSHelper you can enter this into the address bar of a file explorer:
sftp://(IP or name)/path on android device/
You can then explore the Android device as though it was a local filesystem.
What is your goal? Do you need to transfer files to and from? I ask because there are much better ways than ADB.
Many, including my free app SSHelper. But there are many others.
Install my free Android app SSHelper and use the provided wireless connection.
Free, open-source, no ads, no "get pro" BS.
> But even though Debian allows multiple-architectures
No single Debian installation allows multiple architectures, apart from a very slow emulator application, which is more a circus stunt than a way to get cross-processor-compatibility.
Debian can host cross-compilers, but this doesn't mean it can run any result of a compilation.
Nevertheless, if the program has no graphical interface, and if you installed all the Android toolchain components, then you could compile an Android-compatible binary as I do for one of my Android apps.
On tiny systems Busybox is a blessing. I used it on my minimal Linux environment in my Android app SSHelper. A full set of utilities would have been impossible because of size issues.
> BusyBox is the complete antithesis of that [make each program do one thing well].
That's certainly true -- it's a hack. A clever hack, but a hack nonetheless. :)
The other day I found out my dumb, cheap security cameras all run Linux and have Busybox installed. They're tiny, just a few ounces, but someone took one apart and connected up a terminal -- Linux! Command line! Normal utilities like Dash!
I could hardly believe it.
> What can I do to transfer files off by phone to my PC?
Install my free, open-source no-ads app SSHelper on your Android device, then use it to bidirectionally transfer files as well as browse the Android device with a Linux desktop file explorer.
I guess by then, that feature had become a bug. :)
I always install an SSH server on my systems anyway, I find them very useful. Even one of my Android apps has one.
> s there really no way to do it?
Of course there are ways to do this. Start with my free Android app SSHelper, which is an SSH server and terminal session app.
There is also Termux, a very good free program with a similar purpose.
Even though I wrote SSHelper, if I wanted a good flexible utility to communicate between Android and Linux, I would choose Termux over my own program (which is mostly for efficient cross-platform use of rsync and sftp). The authors of Termux have created a rather complete Linux environment on Android that needs to be experienced to be believed (package manager, many options, robust).
Both these programs are accessible from Linux, and can also be used from Android to access a Linux desktop.
> I'm using lubuntu 19.04 and when I'm trying to copy a folder or multiple files at a time from my android device through usb, in the case of folder it copies only the folder not the files inside it and in the case of copying multiple files at a time it copies only one or two file.
I see you're using a direct USB connection, which means you're reliant on the MTP (Media Transfer Protocol), which is a pretty unreliable method for transferring more than one file at a time.
Instead, I suggest that you use my free Android app SSHelper, or another similar app (there are many) -- apps that use wireless networking to communicate between the Android device and your local network. Using a wireless connection would seem to slow transfers down compared to a direct wired connection, but compared to complete failure, there's no contest.
Also, regardless of which communication method you choose, the Android filesystem isn't very much like the Linux one, and some information doesn't transfer over very well or at all, like file dates and permissions.
Android kernels are notorious for being behind the times. On a relatively new Android device using my Secure Shell app SSHelper for shell access:
$ uname -a Linux localhost 3.18.71-15759240 ...
Online reference: : "The 2016 Google Pixel shipped with Linux kernel 3.18, which was first released in 2014 and hit end-of-life in January 2017."
> bash script to run xdotool key alt+Tab and a systemd timer
Can't be done, because a Bash script can't sense individual key presses, while a web page can (with JavaScript). So the user can press arrow keys to navigate the images -- no need to press Enter.
There is a way to reconfigure a Bash script's relationship with stdin, but this isn't portable between platforms (works only on Linux) and a Bash script makes some additional assumptions about the platform, not true for Python.
I've done this both ways over the years, and a small Web server that serves one page is very small indeed. In fact, I have one in one of my better-known Android apps: SSHelper to show the user the system log and interact with the host clipboard. The amount of code involved is small.
So is this problem limited to browsing Android devices that are USB tethered and using the MTP protocol? I ask because MTP is a problem protocol with known limitations, and speed of access is one of the issues.
I have a remedy, it will fix the issue, but it's bit unorthodox. Install my Android app SSHelper. SSHelper runs an SSH server that allows browsing your Android device using a Linux file explorer with this entry:
sftp://(device IP):2222/sdcard/
Most normal file operations are present -- copy, paste, drag & drop, delete (no move to trash). And no more freezes. No USB cable needed.
SSHelper is free, there are no ads, no "get pro" BS, and it is open source.
> when the script will exit, will it only kills itself or the parent ( termux )?
No, an exit from a script only exits the script.
> Like the intruder can delete the script or the credentials file itself.
That's true, but there's no obvious remedy for that.
> ... termux has a fail safe mode which literally opens flaws in the security.
Not Android security, not on a non-rooted device. I know this because I have an Android app similar to Termux called SSHelper that runs an SSH server to let people transfer files back and forth, but it also has a shell environment, so I looked into this issue. On a non-rooted phone, there are no real security issues -- each app's environment is self-contained.
On that topic, even though I wrote SSHelper and it serves a particular purpose very well, Termux is a better Linux terminal session experience. It's very well done -- it even has a package manager. Both are free apps BTW.
There is a convention in some development environments including Android and others, in which the website URL of the originator is used as a path to the project tree -- but in reverse order. If the owner's site URL is arachnoid.com (just an example, my site), then a typical project path would be:
com.arachnoid.sshelper
Which is my Secure Shell server for Android. I don't know where this convention originated but it's a way to organize software projects in a tree from general to specific.
> I would like to be able to transfer files from one to the other without having to plug it in.
My Android app SSHelper does this. It runs an SSH server on an Android phone/tablet. Browse the Android filesystem in your Linux file explorer, drag & drop, transfer files using rsync, and so forth. Free, open source, no ads, no "get pro" BS.
> Surely there's a solution to my problem, right?
Yes, there is. Download by Android app SSHelper (free, open source, no ads). It's an SSH server that allows your Linux desktop/laptop machine to transfer files from/to your Android device.
After you install SSHelper, try connecting from a laptop or desktop:
$ ssh (name/IP of Android device)
The first connection will ask for a password (which you should change on the Android device from the default of "admin"). If you don't want to enter passwords, do this:
$ ssh-copy-id (name/IP of Android device)
The above command will ask for a password once, then never again.
Now open a file browser on the laptop/desktop. Enter this into its address bar:
sftp://(name/IP of Android device)/desired-path/
Now your laptop/desktop is connected to your Android device. You can drag & drop files from one to the other.
You can also use rsync for larger transfers and automated updates:
$ rsync -av /local-path/ android-name-or-IP:/remote-path/
There are various ways to gain access to the Android external storage device, and all Android applications have the same problem -- Google makes this as difficult as humanly possible. I discuss the available options in the SSHelper documentation.
Yes, like so many Busybox options -- they must be selected to be compiled in, but most Termux users won't move to that level to get more functions.
But while logged onto my app SSHelper I can see why Termux doesn't make "swapon/swapoff" available -- it's already provided by the default Android system (via "toybox").
$ ls -la which swapon
lrwxr-xr-x 1 root shell 6 Jun 13 2017 /system/bin/swapon -> toybox
It's similar. maybe more polished, but with more of a commercial intent (it's free to install).
The linked article has the title "Suddenly Linux runs in Android". This is misleading. Many Android apps run Linux in some form, including my own.
> So the config as is at present, should allow them to write to the server?
I don't know because I haven't seen the configuration.
> However, this specific user can't upload with the above config, only read.
For a multi-user logon, each user must have the right to write to the server. One way to accomplish this is to assign write privileges to the "user" group at the server. But this means any "user" who logs on can write there.
Another way to do this is to create a new group on the server (and client) with special privileges -- any suitable name. Then make each person who should have access rights, a member of that group. In this setup, you choose who has access rights, not simple membership in the "user" group, i.e. everybody.
The simplest way to break this logjam is to show me the directory listing for any file in the server's directory. Log onto the server:
$ ssh server-name
Then navigate to the directory in question and type this:
$ ls -la
The files will be listed with their access rights, and the directory will be listed with its access rights (a directory must have execute bit set to allow read/access of the directory).
I should add that ftp by way of a file explorer allows a lot of access unless you exercise control over the server's permissions. It would be ironic if a user couldn't access the desired files but could overwrite something more important without meaning to.
BTW, while we're on the topic, I have a free, open-source Android app called SSHelper that gives this same kind of sftp access to the file system on an Android device, along with all the other Secure Shell modes.
> Static binaries? That's interesting.
Yes, but they're about to be disallowed/disabled (in Android 9 and later). I know this because I used static binaries for my app SSHelper and early Android 9 users reported to me that my app had stopped working. I had to change to dynamic binaries, probably a good idea anyway.
The advantage of static binaries is that you get the immunity from your environment that you get with containerized apps on Linux (like Docker). The drawback is they're much bigger then they have to be if they use the Android ecosystem instead. And the drawback to the latter solution is that the ecosystem is different on each Android device and version.
> I have a RPI3 running DietPi and I'm mounting an NFS share
> Would I have better results by mounting as CIFS?
In my experience, Secure Shell is a much better alternative than any of these. Secure Shell has the sshfs utility (allows local mounting of remote directories), rsync (very efficient directory tree synchronizations), and sftp (which allows you to use Linux file explorers to browse remote file systems).
My experience with Secure Shell has been so positive that I wrote an Android app -- SSHelper -- that allows me to use these same features with my Android devices.
Beyond these advantages, all Secure Shell transactions are encrypted, and passwordless logons are easy to set up, thus securing the transactions against hacker attacks.
In my experience, Secure Shell cannot be meaningfully compared to any of its alternatives -- it is way superior.
> Busybox is also distributed as a static binary.
It can be gotten that way, but it's not a requirement. It successfully compiles as a PIE dynamic executable, which is required for Android 9 and newer versions. Here's the result in my Android app SSHelper for the Busybox I provide with it:
$ file busybox busybox: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, stripped
> but my phone cannot ping my PC.
That shouldn't be true, but I think I know the reason. I should have clarified -- for most phones, you have to ping by IP, not name.
> ... my phone is listed as '?' and have my local ip address wrong!
Do you mean the phone itself is showing a different IP than OpenWRT is showing? I think I know the reason -- the phone has mobile data turned on and it's trying to talk across the mobile IP, not the LAN IP.
I have this issue with my Android app SSHelper, an OpenSSH based server that people use to transfer files wirelessly. If a phone has mobile data enabled, things can get confusing as to which network connection is being used.
But please provide a few more details. I think you can open a shell session in OpenWRT, which means you can try pinging the phone from there as well as from the desktop machine. This might clarify some things.
I think it's a clever plot to get Windows users see the value of open source. OpenSSH is such a useful tool and so unlike most Windows software that it's positively subversive. BTW I brought OpenSSH to Android for the same reason -- SSHelper.
Well, I can think of one trick that might work. Run ssh-copy-id on a laptop, then copy the resulting ~/.ssh/authorized_keys from that machine to the device that doesn't respond directly to ssh-copy-id.
One problem is that a Secure Shell server that doesn't respond to ssh-copy-id might not accept an authorized_keys file either. I personally think everyone should use the OpenSSH code base for this kind of work, but that may be unrealistic for Android and other devices where it's difficult to get working. I know this from personal experience -- my Android app SSHelper relies on the OpenSSH source and it's not easy to set up.
My Android program SSHelper does this. You log onto your Android device just as though it's a TTY server (which it is).
It's definitely time for a combination of Wireshark and /var/log/syslog to see what's going on. Secure Shell is notoriously failure-proof (I even ported it to Android) that I'm also mystified.
> I would love synching across multiple desktops and my android phone, ideally over my own server.
Do you mean syncing notes created with apps like Tomboy, or syncing everything? BTW Android also has note-taking apps, but of course they're not compatible with Tomboy's .note file format. I recommend that you use a more portable document format, like LibreOffice's ODF, which would be portable across platforms.
Or consider taking notes in plain text, with the assurance that the results will be readable anywhere.
As to the task of synchronization, there are a number ways to accomplish that, and Linux is fully equipped to manage this. I wrote a free Android application called SSHelper that lets you synchronize from Linux as well, using the standard tools: Secure Shell and rsync.
By "without using the Internet" do you mean without using networking, or without using the WAN?
My free Android app SSHelper runs an OpenSSH server on your Android device, with connections your local network, and accepts all Secure Shell connections including "scp" and "rsync".
But be aware that the Android file system is not a Linux file system, and synchronizing Linux and Android files is a bit tricky, not unlike synchronizing Linux and Windows file systems.
> I just want to plug in my phone and have it accessible as a drive, automatically.
Here's my suggestion:
Install SSHelper on the Android phone.
In a file browser's address bar, enter "sftp://(name or IP of the Android device)"
Full disclosure -- I wrote SSHelper, it's free, open-source and it doesn't have advertising.
My free Android app SSHelper, apart from supporting OpenSSH and Secure Shell, has a clipboard server that bidirectionally shares the Android clipboard with any computer (Windows or Linux) that happens to be on the local network.
> I've been unable to connect it up to the PC while I'm waiting on them to arrive.
Try my free Android app SSHelper. It's an efficient way to do what you want.
Complete agreement -- Android is Linux. When I log onto my Android app SSHelper, I see a command line and a suite of Linux utilities. I have to think twice to remind myself that I'm not logged onto one of my laptop/desktop Linux systems.
It's the same with Termux, except that Termux does a better job of representing a Linux command line than my app does, and it has a ... wait for it ... package manager -- you can install any number of command-line utilities familiar to users of desktop Linux.
Then there's Andronix, which depends on Termux for some of its functionality and allows you to install Ubuntu, Debian and a few other distributions with ... desktop environments. Yes, that's right, desktop environments. The desktops are accessible with a VNC client app, either on the Android device itself or from any locally connected system.
(Forgot to add, all these apps are free.)
All these Android apps run on Android's Linux kernel.
So yes ... Android is Linux.
Try using SSHelper. It's the only app that I've found seems to work universally.
> NFS/Samba both exist for some reason too right, do they offer some other advantages/disadvantages compared to SFTP?
They both still exist, I have some experience with both of them, but they are both less useful and reliable than SFTP. Samba in particular is a disaster when used with Linux, because Samba is not meant to be used with a Linux filesystem and doesn't support Linux file conventions fully. (Samba is really meant to create a bridge to Windows, not be used between Linux servers.)
As to NFS, it's hard to set up and is much slower than SFTP.
In modern times, there is literally no competition for SFTP and related Secure Shell tools for file management. Also, very important, if you have an offsite server that you need to keep synchronized, you can log onto an Internet server using SFTP (after sharing your ID and disabling password logons of course) and have the same speed and reliability, and security, that you have on your LAN.
I have a remote Web server running Ubuntu that I update regularly with new content. I have a full copy of the Website content locally that I use to test new pages and resources. Then, when I'm ready to publish the new content, I just say:
$ rsync -av (local path)/ (remote name:remote path)/
And I am done -- rsync completely synchronizes the remote server, with every file, every date, every property of every file, identical.
I am so confident of the value of Secure Shell that I wrote a now-well-known Android app to be able to extend this kind of file management to the Android platform. My app SSHelper provides much of the power of Linux filesystem synchronization to Android (although because Android isn't a pure Linux filesystem, the synchronization is not really comparable to the result one gets on Linux).
There's a reason that Secure Shell is taking over from many older protocols like Telnet, FTP and others -- it's much better and more secure.
Thanks! For those who wonder what SSHelper is: SSHelper
I use SSHelper which also supports rsync: https://play.google.com/store/apps/details?id=com.arachnoid.sshelper
I use SSHelper and rsync or sshfs on the Linux side.
Side load this and you can manage it via SSH: https://play.google.com/store/apps/details?id=com.arachnoid.sshelper
Maybe there's a VNC Android app you can side load? Try XDA Developer forum.
I haven't tried it but you can do rsync on Android with SSHelper
> First of all, thank you for taking the time to respond. If you're the Paul Lutus who wrote Apple Writer then damn, there's not much for me to say except that I'm sorry to waste your time on noob questions.
You aren't wasting my time -- I like helping people with computer problems. And it's how I pay it forward.
> To alter Busybox's functionality I would have to compile my own build.
Yes, but you can also add utilities to a system that hosts Busybox. That's how I do it in my Android app SSHelper, and it's how Android itself adds utilities to its choice of toolbox (similar to Busybox) called "toybox".
> I knew that Busybox had a fixed number of functions, I just thought the combination of those functions available for use could be more easily adjusted.
Only by changing the build configuration and recompiling. The reason is that Busybox is a single executable binary that decides what to do based on a set of symlinks, all of which link to the binary. For example if I enter "ls" , a symlink by that name invokes the Busybox binary, and the latter uses the symlink name to decide how to react.
Like this (logged into my app SSHelper):
$ ls -la which ls
lrwxrwxrwx 1 u0_a56 u0_a56 45 Oct 29 21:11 (path)/ls -> (path)/busybox
Good plan. But I'm biased -- I wrote SSHelper.
How about this -- download your media to your desktop/laptop, then move the results to your phone using my free SSH server app SSHelper. That would be simpler than trying to make youtube-dl work on Android.
> I've tried using id_rsa from my server and that doesn't work.
RSA should have worked, what was the app on the phone that rejected this key?
> But with my phone I'll have to copy and past the code onto the app.
That's not a very advanced application. The better Secure Shell Android apps let you use ssh-copy-id just as with a desktop/laptop, including mine (SSHelper) (free).
There are an increasing number of very good Secure Shell applications appearing just now, some of them better than mine, but the bottom line is if you have to copy and paste a key, the program is junk and you should change to another one.