SSH server on Android N (no root) with write access to the SD card - Android General

I want to mount all of my phone's storage read/write with ssfs, but I haven't yet found an SSH server able to do that properly. SimpleSSHD came closest, but it doesn't get write access to /storage/148C-40DE, which is my removable SD card. Also, it doesn't support setting the file attributes and date/time, which is annoying (all files I copy to the phone will have the current date/time).
It's not the protocol, because I've also tried the open source Primitive FTPD app, and it had the same problem. So back to SSH, I've tried a bunch of other free and paid apps from Play, and all had the same problem with the external SD Card, except for WiFi FTP Server, which was able to write on folders in the external SD card, but the connection kept breaking to the point of being unusable, but it did show that it's possible for a server app to offer write access to the SD card without root.
So is there a current solution to run an SSH server on Android Nougat with write access to the external SD card? The guides I've found were very old (2011).

Nothing?

I'm looking for the same thing, since I really want wireless file syncing with my microSD card, but NFS/SMB is out due to not being rooted.
This is the best one I've seen so far -- https://forum.xda-developers.com/android/apps-games/app-ssh-sftp-server-terminal-interface-t3740091 -- https://play.google.com/store/apps/details?id=net.xnano.android.sshserver
It can write to the SD card. But it does have some odd issues -- file modification times aren't kept, and mounting from windows causes an error if you have more than one root per user (workaround: I just created a user for the internal memory root and one for the SD card). But the modification time is a big problem. I haven't found any SSH server on Android that keeps modification times, where openSSH out the box does it on Linux.
In the reviews for this app someone mentioned a better app that's not on the playstore, but I couldn't find one like that.
I'm surprised no one has really gotten wireless sharing on Android working well yet (and frankly, I'm surprised it just isn't support by Android directly on the correct port numbers.

Related

[Q] - Mount SD card like my phone does

I've poked around but I dont think I found what I am trying to do. I want to mount my SD card like it mounts my phone; install the apps to the device, store the data on the sd card... any way to do this?
You can' do it, honeycomb doesn't support installation on external sd cards for now. Vanilla honeycomb can't even write on external sdcards, for exemple on the motorola xoom. You can read/write on some tablets thanks to the respective manufacturer's 'tweak'.
I dont want to store the apps on the SD card, just the data, downloads, photos taken from the camera, ect. all I see is a Removable\MicroSD folder which I can browse to, read/write to, but I want all the data on my apps to go to it too just like on my phone, so when I wipe, all my stuff is still there (In theory)
They won't be deleted even if they are on the internal storage even after wiping. It acts as a sdcard.
I might be mistaken, but thanks to the honeycomb 3.2 OS update, it IS possible now that they've opened up the API to the developers.
Unfortunately, it actually depends on the application developers to make use of it... Leave some comments on the android market for your apps and maybe they will do it.
i'm probably mistaken. post from a random website regarding new features in 3.2:
Media sync from SD cards, allowing users to load media directly from an SD card to applications which use them
I did not realize that the folder was persistent, that's good to know thanks

VZW GS5 Adoptable storage, how to access.

I have adoptable storage working per the S7 command line method with ADB. Now, as for how I can access it.. Since its encrypted the PC can't read it directly. Is it possible to use linux commands to create a linked folder on the phone's actual internal storage to the root of the adopted sd card? Wouldn't this cause the phone to handle the encryption work and let us have access to it? The other question is would this created link survive a reboot? I remember when I did a linked folder I had to have a script autorun on boot of the Android 3.0 tablet to recreate the link.
Nova5 said:
I have adoptable storage working per the S7 command line method with ADB. Now, as for how I can access it.. Since its encrypted the PC can't read it directly. Is it possible to use linux commands to create a linked folder on the phone's actual internal storage to the root of the adopted sd card? Wouldn't this cause the phone to handle the encryption work and let us have access to it? The other question is would this created link survive a reboot? I remember when I did a linked folder I had to have a script autorun on boot of the Android 3.0 tablet to recreate the link.
Click to expand...
Click to collapse
Since adopted storage becomes internal, it's best to think of it as you would a hard drive in your PC. You don't physically connect PCs or remove hard drives to transfer files; you networking or apps. There are a myriad ways to do this: FTP, SMB, BitTorrent Sync (my preferred way), SendAnywhere, SuperBeam, etc.
WiFi is far slower than USB3. USB3 would be my preferred method to load up music on it vs wireless methods.
Nova5 said:
WiFi is far slower than USB3. USB3 would be my preferred method to load up music on it vs wireless methods.
Click to expand...
Click to collapse
The interface is only theoretically faster. The S5 uses MTP to connect to your PC over USB, which means writes are made at the file level, not the block level. Translation: if a file has changed on the S5, your PC rewrites the entire file instead of just the changes. This makes routine USB file transfer extremely inefficient.
OTOH, using BitTorrent Sync with an 802.11ac router gives me block level write speeds of up to 16 MB/s, which is pretty good for the S5's notoriously slow SD card R/W performance. And if you have a slower router you can just let the network transfer run overnight anyway.
All fine and dandy, but not important to the answer sought. What im looking at doing is creating a symlinked "folder" that I can drop large amounts of data on, and have it sent directly to the card. Permissions are currently the issue on looking into the "private" directory on the phone for its storage. I just have to look up the command structure for the permissions changes when I get time to dig into it. Might not work depending on what protections google put in place to prevent those changes as they could compromise security.

Why can't various SSH servers see my sdcard?

Hi,
I have a stock Galaxy S7 running 6.0.1 with an SD card configured as portable storage. I tried two SSH servers (Ssh Server and SSH Server, I know the names are not very helpful) and they both work fine. However they can't access my SD card.
Is it possible to get this to work, can this never work, etc.? Various file managers can work with the SD card. I don't understand why the SSH servers don't.
The question behind this question is what's the easiest/fastest way to get a 100 gig of files onto an SD card that a phone or tablet running Marshmallow can access. Without Windows or Mac I don't know of any better way. Why, oh why didn't Android provide a normal plug and play USB interface like you normally get with most devices where you can mount all the drives and act like they're local...
If anybody has ideas on this that would be nice. If not if I can at least access my SD card from an SSH server running on the device I'll be able to pump my files over from my various systems.
Thank you.
Updated: I built the latest libmtp and stable gmtp today and it starts working great but eventually crashes in the middle of transferring a bunch of files. Oddly, it seems to die on the same file each time. I don't have time right now but later I'll check and see if I can prove whether it's after some amount of time/data/whatever or if the file is bad (unlikely). So unless somebody has a better idea how we can get good ole' 1990s USB mass storage working I'm kinda screwed atm.
midnightrider said:
Hi,
I have a stock Galaxy S7 running 6.0.1 with an SD card configured as portable storage. I tried two SSH servers (Ssh Server and SSH Server, I know the names are not very helpful) and they both work fine. However they can't access my SD card.
Is it possible to get this to work, can this never work, etc.? Various file managers can work with the SD card. I don't understand why the SSH servers don't.
The question behind this question is what's the easiest/fastest way to get a 100 gig of files onto an SD card that a phone or tablet running Marshmallow can access. Without Windows or Mac I don't know of any better way. Why, oh why didn't Android provide a normal plug and play USB interface like you normally get with most devices where you can mount all the drives and act like they're local...
If anybody has ideas on this that would be nice. If not if I can at least access my SD card from an SSH server running on the device I'll be able to pump my files over from my various systems.
Thank you.
Updated: I built the latest libmtp and stable gmtp today and it starts working great but eventually crashes in the middle of transferring a bunch of files. Oddly, it seems to die on the same file each time. I don't have time right now but later I'll check and see if I can prove whether it's after some amount of time/data/whatever or if the file is bad (unlikely). So unless somebody has a better idea how we can get good ole' 1990s USB mass storage working I'm kinda screwed atm.
Click to expand...
Click to collapse
there is a Galaxy S7 forum
http://forum.xda-developers.com/galaxy-s7
Sent from my XT1254 using XDA Labs
sd_shadow said:
there is a Galaxy S7 forum
http://forum.xda-developers.com/galaxy-s7
Sent from my XT1254 using XDA Labs
Click to expand...
Click to collapse
Thanks, but this is a generic Android Marshmallow issue as far as I know.
It appears the SD card filesystem is not world writeable. TotalCommander allows me to change it in the GUI but it doesn't actually get changed. No error or warning messages either.
edit: ok after hours of searching here and on the net this is apparently caused by design in Marshmallow. The permissions on the SD card make it not happening to directly update the card. I think, but I am not sure, there is an API for applications that want to write to the card. Some apps can certainly do it. I found a thread here where a guy figured out a solution if you are rooted. I'm sorry but I accidentally closed the tab (DOH!) and lost the link.
The choices seem to be:
1) ask the dev to fix his app to be able to write on the SD card
2) root your phone and change permissions or change the xml file to deal with it
3) use your SD card as adoptable storage. This only works if you have a really fast/expensive card otherwise your performance will suck hard and you'll be miserable. Lots of other downside to this, probably not worth it.
I have no idea if this is going to be fixed in N. I hope so because it is a huge PITA. And stupid!
I just built the linux fuse support for exfat and am downloading a bunch of doc to the sd card from linux. After I fill up the card I'll test it out and update again. Very easy build, the whole thing was less than 3 minutes. For anybody who wants to try this on a non package managed linux (I use Slackware) see here: https://github.com/relan/exfat

Encrypted portable microSD card in Settings; apps can't read it. Help?

Not sure if many of you are aware, but the U11 allows you to encrypt portable microSD cards in the settings, which is nice for privacy purposes. The problem is since I did that (I even rebooted after) many of my apps can't properly read or write to the microSD card. I've noticed many of said apps don't implement Google's expandable storage permissions properly either (i.e. they don't ask you to select the root directory of the microSD card in Android File Explorer so they have proper read-write access to everything.)
My questions, therefore, are:
What am I doing wrong? Is there some permission I'm missing?
Are 3rd party apps supposed to be able to work with encrypted portable storage?
Is encrypted portable storage even an AOSP feature? Or something specific to 3rd party OEMs?
Why do so many apps not implement microSD storage read/write permissions correctly?
Any ideas?

Upgrading micro SD card to another larger one breaks apps [SOLVED]

I have swapped my older microSD card (64GB) for a larger newer one (256GB), both are formatted as external SD with the exFAT file system (so it can be read with a computer using a microSD card reader for faster and easier file transfers).
The swap initially appeared to be a success, with photos and videos taken with the Samsung stock camera app able to be stored on the new external card. A third party video recorder also worked the same on the new card as it did on the old one (able to select a specific folder and saves properly). Playing back and accessing content from the new card worked fine in a variety of applications (accessing file types: various videos, audio mp3 and FLACs, .PDF, .doc, .epub, .cbz, etc.)
Unfortunately some apps will simply not work, while others which needed to have save locations redirected returned surprising effects.
Titanium Backup v8.1.0 simply does not launch with the new card (returns error Unfortunately, Titanium Backup has stopped.) I have tried first clearing cache and then even uninstalling/re-installing the app - no dice. I swap back to the old card and all works fine. This is the failure that smarts the most as it breaks my phone's app backup plan.
Zedge v5.70.3 app launches and seems to work until I go to install anything to the phone (ringtone, notification sound or wallpaper), then I get a Download failed error and the chosen item is not added. There is no way to swap the download location for the new card. Again I have cleared cache, un-inistalled and re-installed without success. I have sent them a support ticket.
Call Recorder Pro v 1.9 (Tohsoft) required me to change the ''Location of recording'' folder to SD card (no choice of which folder) and this selection resulted in a totally different and complex directory structure used on the new card:
Code:
/storage/emulated/0/Android/data/com.tohsoft.call.autocallrecorder.pro/files/CallRecorders
while on the old card I was able to use a more sensibly located folder in the root of the microSD card as follows:
Code:
/storage/6958-0839/CallRecorders
As the app works and the files can be retrieved this is not a deal breaker, but it is an added hassle now to locate the recordings!
I checked both cards using ES File Explorer and in the folder
Code:
/storage
they each show up as different folder names
old card: 6958-0839
new card: 0102-1A79
A bit of poking around searching online and I determined these were the unique volume IDs and not the volume names. Apparently these can be changed on a PC but I am unsure if this would have other implications. I also looked around for symlinking (which I use on my PCs to map my NAS shares), to see if a virtual link could be made to fool the operating system into thinking the cards were the same one. There was some info about this but I am not sure where I would put the symlink if the file system allows me to create it (on FAT file systems such as the microSD card's one this is a no no apparently, but I do not know the file system of internal memory where the link to the external SD would need to be - I wonder, is it using one of the Linux Ext file systems that support symlinks?)
I was guessing that a symlink for the new card named 6958-0839 (to look like my first working microSD card) should be placed in the following folder (after selecting Device in ES File Explorer):
Code:
/mnt/media_rw/
My handset is a Samsung Galaxy Note 4 N910U Android 6.0.1 stock rooted
I have tried searching here about this issue without success. Apologies if I am asking something that has already been answered - please direct me accordingly in this case.
Any assistance will be greatly appreciated.
Ok so I have solved it I think (TitaniumBackup launches ok again).
I changed the exFAT Volume Serial Number on the new card to be the same as the old one.
I ended up using Krylack Volume Serial Number Editor. I tried first using SysInternals VolumeID v2.1 and I was able to run the command but I was receiving an "Unrecognised Drive Type" error and the documentation says NTFS and FAT support (no mention of exFAT so maybe the tool is too old).
After applying the fix mentioned above I noticed that I am also running an app called XInternalSD with "Custom path to internal SD" ticked and the path set to
Code:
/storage/6958-0839/
I have not tried, since everything works for me now on the new card that I edited the VSN on, but I assume that if I had changed the numbers in the path field in the XInternalSD app to the new VSN that would have worked also...

Categories

Resources