greyltc / android_external_sshfs Goto Github PK
View Code? Open in Web Editor NEWFuse based ssh file system client for android devices
License: GNU General Public License v2.0
Fuse based ssh file system client for android devices
License: GNU General Public License v2.0
To make it easier to install, please consider packaging an .apk and adding it to the f-droid.org app listing.
Can this be packaged as an APK? I'm running CM11 M9, and would love to use this to connect to a media server.
Hi, I have been porting a lot of unix-y programs to my phone recently, and I'm wondering if this uses any features that would actually require a custom ROM, or if it was just developed primarily for cyanogen.
I really don't want to bother with flashing to cyanogen; I'd like to use it on my almost-stock android device. Cyanogen has a lot of stuff I don't need and/or want. I can build depended libraries, probably.
I've already compiled openSSL and gnuTLS, for example. I also think I am prepared to build glibc for it. Anything short of the kernel, basically.
SSHFS properly mounts the folder, but if you try to open anything but a folder, the SSH server successfully opens and closes the file, but the SSHFS client reads a few bits of the file, and then immediately ends in a memory violation sig 11 seg fault.
Command used to connect:
sshfs [email protected]:/ /system/sshfs -o ro -o allow_other -o follow_symlinks -o StrictHostKeyChecking=no -o reconnect -o TCPKeepAlive=no
Full catlog from before issue occurs to after issue occurs
Clipped catlog from where problem started and ended
Filtered catlog by 'ssh'
Note: I might have been using Enforcing SELinux mode at the time of the catlog saves, but the same issue happens in Permissive SELinux mode.
2nd Note: See my first issue that explains related problems, and more details on my setup: #4
SSHFS Process crashes when accessing a file.
Tested on:
Test:
root@hammerhead:/ # sshfs user@host: /sdcard/sshfs/
The authenticity of host 'host (192.168.xxx.xxx)' can't be established.
ECDSA key fingerprint is ...
Are you sure you want to continue connecting (yes/no)? yes
user@host's password:
root@hammerhead:/ # ps | grep ssh
root 10301 1 2628 1332 c027636c b6dc56d8 S ssh
root 10305 1 5412 228 ffffffff b6e09908 S sshfs
root@hammerhead:/ # ls /sdcard/sshfs/Downloads/test.file <
/sdcard/sshfs/Downloads/test.file
root@hammerhead:/ # cat /sdcard/sshfs/Downloads/test.file
tmp-mksh: cat: /sdcard/sshfs/Downloads/test.file: Transport endpoint is not connected
root@hammerhead:/ # dmesg
...
<7>[ 1171.776191] SELinux: initialized (dev fuse, type fuse), uses genfs_contexts
<3>[ 1229.253004] init: untracked pid 10305 exited
<3>[ 1229.259947] init: untracked pid 10301 exited
...
Hi John,
first of all: Thanks for porting sshfs to Android.
I'm not very experienced in building Android/CM so this entire issue could easily be my fault but maybe you have a clue for me how I could make it happen after all...
I prepared
~/android/system
as described in the README.
I did have some issues during the build concerning mpdecision, thermald and camera.default.so. But when I excluded those from the make I succeeded in building the image.
Afterwards, I cloned your repositories, however I used the cm-10.2 branches as my CM tree is 10.2:
$ git clone -b cm-10.2 https://github.com/l3iggs/android_external_glib.git ~/android/system/external/sshfs
$ git clone -b cm-10.2 https://github.com/l3iggs/android_external_glib.git ~/android/system/external/glib
after
cd ~/android/system/external/sshfs
adb root
adb remount
mmp -B
the build fails pretty quickly, complaining:
PRODUCT_COPY_FILES device/htc/pyramid/keylayout/AVRCP.kl:system/usr/keylayout/AVRCP.kl ignored.
No private recovery resources for TARGET_DEVICE pyramid
make: *** No rule to make target '/home/user1/android/system/out/target/product/pyramid/obj/SHARED_LIBRARIES/libglib-2.0_intermediates/export_includes', needed by '/home/user1/android/system/out/target/product/pyramid/obj/EXECUTABLES/sshfs_intermediates/import_includes'. Stop.
make: Leaving directory '/home/user1/android/system'
I then attempted to build the glib first but failed doing so:
First, it complained about missing LOCAL_MODULE_TAGS. Once I had added those into each of the .mk files, I received the following error message:
external/glib/glib/gbitlock.c: In function 'g_futex_wait':
external/glib/glib/gbitlock.c:84:12: error: 'SYS_futex' undeclared (first use in this function)
external/glib/glib/gbitlock.c:84:12: note: each undeclared identifier is reported only once for each function it appears in
external/glib/glib/gbitlock.c: In function 'g_futex_wake':
external/glib/glib/gbitlock.c:101:12: error: 'SYS_futex' undeclared (first use in this function)
which I couldn't resolve.
I would be grateful for any pointers.
I am rewriting this issue report because I have found more details on what the problem is.
I successfully built sshfs for CM12.1-based rom. (had to rename "#include <syscall.h>" to "#include <sys/syscall.h>" in external/glib/glib/gbitlock.c to build properly for Lollipop)
Now, I used official CM12.1 source tree, but my rom is Resurrection Remix 5.1.1r2 for Moto X 2013. I'm not sure how sincere you are when you say "the source tree needs to be what your rom is built from", because my familiarity of how building things for Android differs from building for Linux is about 5%. lol. Based on my experience with Linux, I thought it'd be fine to use CM12.1 since my rom is based on it, and there is no clear guide on setting up a Resurrection Remix source tree (if that is even what you're asking for).
Anyways, it built successfully and even mounts the SSHFS properly, except there is one bug that makes the whole thing pointless... When in the root shell in Terminal Emulator, the files on my SSH server are properly read and up-to-date. The problem is that any app trying to access this folder, whether it has root access or not, sees the folder and its contents as if the mount never occurred.
Example of reproduction on Resurrection Remix (and I assume other Lollipop or CM12 based roms):
First, I created /system/sshfs with 0777 permissions.
I mounted sshfs using the exact line in your README.md to /system/sshfs.
ls -l /system/sshfs shows the files AND folders, all with 0660 permissions. Same with the /system/sshfs folder itself.
Now, if I goto /system in Root Explorer (root or non-root mode), /system/sshfs is shown to have 0777 permissions. When I go into the folder, it is empty. I can create a file there... but it does not show up in rooted Terminal Emulator, which still acts like the folder is fuse-mounted. Then, I exit to normal user mode in Terminal emulator, and presto, the folder with the file I created shows up.
If I "su -" in Terminal Emulator again, the files from my SSHFS mount are back.
It seems to me that SE Linux changes or SE context introduction in 4.4 is causing sshfs to fuse mount inside of a sandbox of some sort... which makes it inaccessible outside of the same environment that mounted it.
If you can correct any mistake I made kindly, in case it was user error on my part, please... please do so... I have wrung out my knockers trying to get working SSHFS off and on for the past year, ever since SSHFSAndroid stopped updating (which is around the time I bought it... :/ ).
When following the instructions:
git clone https://github.com/greyltc/android_external_glib.git -b cm-10.2 ~/android/system/external/glib
it prompts for a password. The prior git command did not prompt for a password.
Hello,
I'm trying to find a working sshfs solution, and I found this lib.
I'm trying to compile it for CM 12, (not sure if it is supposed to work). I think I got the requirements, CyanogenMod dev environment.
I get this error:
No private recovery resources for TARGET_DEVICE
make: *** No rule to make target '/home/blum/android/system/out/target/product/falcon/obj/SHARED_LIBRARIES/libglib-2.0_intermediates/export_includes', needed by '/home/blum/android/system/out/target/product/falcon/obj/EXECUTABLES/sshfs_intermediates/import_includes'. Stop.
make: Leaving directory '/home/blum/android/system'
The build environment is 64bit Arch Linux.
Have no idea how to proceed.. Can you help me with some advice what should I try?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.