[Q] SSHFS... almost got it working... - General Questions and Answers

I have SSHFS working from a Debian chroot. I have a SGS2 (SGH-i777) with CyanogenMod 9 (2012-06-12 nightly), and everything is working as the root user. I can read the SSHFS mount and the files it contains. My problem is that a normal, non root user cannot read the SSHFS mount. The UID/GID of the mount is 1000/1000, which is the UID/GID of the user that owns the source of the mount (my primary workstation user).
I'm trying to use KeePassDroid to read my KeePass database in place, so any changes I make get immediately reflected in my master file, no need to replicate the file. If I could grant KeePassDroid sudo privileges, I think that would be good enough for me. But I'm stuck. I don't know enough about how users are managed on Android, and I don't know how to give superuser privileges to an arbitrary application (it doesn't appear that the Superuser app that shipped with my root ROM allows for that). Any ideas?

SSHFS... almost got it working... a little closer now....
I've finally gotten a chance to look at this further. It looks like sshfs (the mount utility) has the capability of using an arbitrary UID for the owner of the mount. So, I looked in /data/system/packages.list to determine the UID of the KeePassDroid application. Seems the UID for that app is 10079 on my system. But that doesn't work, because if I log into a shell as that user ("su - 10079"), the keepass directory doesn't even show up in an ls directory listing. I've also tried 10080, which is apparently the UID of the OpenIntents file browser used by KeePassDroid to select the KeePass database. It obviously didn't work.
My next try will be to set the entire chroot to be owned by the 10079 user. I'll post back here if I find success.

[SOLVED]SSFS... got it working...
I finally got it to work, had to pass the -o allow_other option to sshfs, and now my KeePassDroid app can read my database. Next task is to have it load the chroot and sundry stuff automatically, so I have access to my KeePass database wherever I'm at.
Hopefully this information will be useful to the next schmo who tries this. I can already see that this thread shows up on Google.

Related

Automatic wireless folder sync app needed

Hi,
I have looked around and cant seem to find an application quite fitting.
All I want is an app that will wirelessly sync just a folder automatically when I have my WiFi turned on, is there an app that can do this?
i.e. Come home from work, turn on wifi and it just syncs.
Many thanks
To any developers about: How hard would something like this be to make?
I think dropbox does that?
Dropbox syncs a folder on multiple devices with a folder on dropbox server.
There is also an app called PCFileSync that syncs a folder over wifi between the phone and a samba share. I am turning it on with Tasker once it connects to my home ssid. Works great!
Sent from my Desire HD using XDA App
samba share? hm........
rsync and ssh would be a much better choice and cleaner, just a script to run.
synflex said:
samba share? hm........
rsync and ssh would be a much better choice and cleaner, just a script to run.
Click to expand...
Click to collapse
http://a-more-common-hades.blogspot.com/2010/07/backup-photos-with-rsync.html
Tasker+Rsync, and combine it with a ssh key and you can automate it easy.
BTW, I decided to do this today.. I have one which backs up /sdcard/DCIM, and another which backs up the entire sdcard, both over wifi to my Fedora Linux workstation. I'll have to figure out how I want to execute these, but I can do it from GScript Lite, Tasker, whatever floats my boat.
Here's the notes I took, just in case I have to do it again in the future, hope it's useful to some folks..
# Get dropbear/dropbearkey from http://www.elkins.org/dropbear.tar.gz
# Get ssh off device and follow instructions (references at the end) to fix it, name fixed file "sshfxed"
# Remount /system rw
~/AndroidSDK/tools/adb shell
su
mount -o rw,remount device /system
#exit back to Linux shell
Click to expand...
Click to collapse
# Install dropbear and sshfixed from adb push
~/AndroidSDK/tools/adb push sshfixed /system/xbin/sshfixed
~/AndroidSDK/tools/adb push dropbear /system/xbin/dropbear
~/AndroidSDK/tools/adb push dropbearkey /system/xbin/dropbearkey
Click to expand...
Click to collapse
# Now get into adb shell and execute in Android..
mkdir /system/etc/dropbear
chmod 4755 /system/bin/dropbear
chmod 4755 /system/bin/dropbearkey
Click to expand...
Click to collapse
# Create keys
dropbearkey -t rsa -f /system/etc/dropbear/dropbear_rsa_host_key
dropbearkey -t dss -f /system/etc/dropbear/dropbear_dss_host_key
Click to expand...
Click to collapse
# Copy and paste the public DSS key the dss command above outputs and put it in ~/.ssh/authorized_keys on intended host. If you need to know more here, google for how to use ssh keys on Linux hosts. Basically if you're going to [email protected], on machine1 under user account "user" you create a file named authorized_keys in the .ssh directory with the output of the previous command, it tells you it's the 'public key', which is what you want to copy. It has to be all one line.
# Now actually use it all and rsync sdcard to your host For debugging, I suggest trying the "sshfixed -l USER -y -i /system/etc/dropbear/dropbear_dss_host_key" part just by itself and make sure you can ssh to your machine WITHOUT any prompting, password, etc.
~/AndroidSDK/tools/adb shell
# the following is all one line..
rsync -rltDv --chmod=u=rwX,g=rX,o=rX -e "sshfixed -l USER -y -i /system/etc/dropbear/dropbear_dss_host_key" /mnt/sdcard [email protected]:/your/path
Click to expand...
Click to collapse
-- References
Get dropbear - http://forum.xda-developers.com/showthread.php?p=8220181
Set up dropbear - http://forum.xda-developers.com/showthread.php?t=442754
Fix ssh client to use urandom - https://www.heiher.info/1592.html
Use it all to rsync over wifi - http://a-more-common-hades.blogspot.com/2010/07/backup-photos-with-rsync.html
Another vote for Dropbox, it works great! Look for referral codes in the comments on Market for some additional free storage. I use it all the time for pictures and vids for the family.
Sent from my HTC Desire using the XDA App
I use S&K sync.
Horrible user interface but once things are set up you need only to start the client on your phone and press the "Start Sync" button.
Supports multiple configuration sets (local/remote directory pairs, ip address, etc), each can be started separately.
Google: "SK sync android"
khaytsus said:
http://a-more-common-hades.blogspot.com/2010/07/backup-photos-with-rsync.html
Tasker+Rsync, and combine it with a ssh key and you can automate it easy.
Click to expand...
Click to collapse
I'm actually syncing to 2 android phones, with dropbox, rsync and dropbear.
Dropbox is good for documents and such, with small filesize and possiblity of sharing with others.
Using rsync for large files like movies and music folders, also some pictures, notes, keepass, and stuffs I like having around, things that's only going around between my laptop and phone.
Running a crontab that scans for my phone in adb devices, if found, pull a "last sync status" file, if interval > 1 hour or changes made locally, do a local notify-send till rsync is done, then execute dropbear on phone, rsync remote and local, kills dropbear, then push last sync file.
This way, no resources is wasted on the phone, all scanning and verification of device, system, and files were done on laptop.
At the same time I'm monitoring my development phone with frequent ssh rsync when it's in range, push updates, kernels and such across in proper folder structure.
This will ensure changes or new kernels were pushed to phone ready for testing.
Could use the same script for both phone, be it adb+ssh+rsync or pure ssh+rsync, but I personally don't like having sshd running in background when I'm connected to wifi hotspot.
Cleaner this way, less resources wasted on phone, and I can have full control over what, where, and when to sync.
I do realise that there isn't much choice for syncronization in the wild, thus you may like yo try something along the same idea, and you may get your own perfect combo to sync.
P.S. backing up, restoring or syncing bookmarks from browser.db and such could be done this way.

Auto Mount SMB shares when connected to WiFi with Tasker + Execute + scripts

So I've really grown to like having my local SMB shares from my media server mounted to my Xoom so that I can stream video and/or music or whatever on the fly. I don't like the mountpoints getting all messed up when I leave the network though, and I had less than stellar experiences with both Mount Manager and CIFSManager.
CIFSManager worked, but didn't integrate with Tasker, so I couldn't automate it. Mount Manager (the paid version anyway) came with a Tasker plugin, but I don't think it was fully compatible with the Honeycomb OS and I had a lot of issues with it (called the developer and left a message a few hours after buying it, hopefully I can get a refund for my $2.99).
Then I found the (free!) Locale Execute plugin and decided to just script the behavior I wanted myself. If you have Tasker and local SMB shares as well this could be a good solution for you. Just install the Locale Execute plugin from the market and follow these instructions. I'll post them here because I can't post to the dev section yet, and I'm not really sure if this is dev worthy anyway.
First I setup a profile for my home WiFi network (WiFi Connected > SSID [my home WiFi SSID]. Then I added an Enter action with the Execute plugin:
Code:
@!sh /[path]/[to]/[chk_and_mnt_script]/cifs_chk_and_mnt.sh
But I needed to make sure the mount points are cleaned if I disconnect for any reason so I added an Exit action with the Execute plugin as well:
Code:
@!sh /[path]/[to]/[umnt_script]/cifs_umount.sh
In Execute the "@" symbol is used to keep the program from echoing commands to "toasts" (the little black notification boxes you get sometimes, like when an app is "granted SuperUser permissions") and the "!" symbol is used to grant the line of Execute code root access.
I removed the toasts but I still wanted some notification as to what was going on and a quick google revealed this xda post: http://forum.xda-developers.com/showthread.php?t=773232
In that post I found a little .apk that would allow me to call a toast from a bash script. I've attached it to this post.
In the mount script I run a little check to find out if the "cifs.ko" kernel module is already loaded. If it is I skip that block, but if not I go ahead and load it. This way I always know that the kernel module is available before I try to mount the SMB shares.
Here's the Enter bash script I wrote called "cifs_chk_and_mnt.sh":
Code:
#!/bin/bash
lsmod | grep -q 'cifs' #check if cifs module is loaded
if [[ $? -eq 1 ]] #if not
then
am start -a android.intent.action.MAIN -e message 'cifs.ko kernel module not yet loaded. Loading now...' -n com.rja.utility/.ShowToast #displays toast
insmod /system/lib/modules/cifs.ko #loads kernel module
fi
am start -a android.intent.action.MAIN -e message 'Mounting local SMB network shares...' -n com.rja.utility/.ShowToast #displays toast
mount -o username=[windows login],password=[your password] -t cifs //[host ip]/[share] /[path]/[to]/[mount]/[point] #actually mounts share
#replace "[]" info with your own with NO "[]" and copy and paste line for as many shares as you want to mount
And here's the Exit script called "cifs_umount.sh":
Code:
#!/bin/bash
am start -a android.intent.action.MAIN -e message 'Home network lost. Clearing local SMB share mount points...' -n com.rja.utility/.ShowToast #displays toast
umount /[path]/[to]/[mount]/[point]
#replace "[]" info with your own with NO "[]" and copy and paste line for as many shares as you have mounted in the Enter script
Now, like I said, I used the linked (and attached) .apk to display toasts from the BASH scripts, but if you don't want it or care enough to use it then feel free to delete the toast lines or throw a "#" in front of them. If you do want the toasts displayed then you'll have to download it and install it. It won't show in your app drawer.
Anyway, here are the files (I had to add a ".txt" extension to the .sh files to comply with xda's attachment rules, but you can just rename them):
Thanks for this, looks great! I literally just paid for one of the premium smb apps only to find it didn't do quite what I wanted. I'm sure this will be what I'm looking for, cheers.
Edit:
Something for users to note: The umount script wasn't working for me, after some investigation it turns out that though when mounting, '/sdcard/dir' is acceptable, though the mount command actually considers my sdcard to actually be at '/mnt/sdcard' , so *that* was the dir I had to use when unmounting afterwards. This may be true for others too. I am using CM7 on a Desire.
Looking into this, I found that on my CM7 Desire, mounting the shares worked even if "lsmod | grep cifs" returns nothing, and the file is not in the place mentioned in your script either. To streamline the whole process, I just removed all the complicated stuff from the script and ran the mount command directly, saving time. Just a heads up for others, try it and see if it works for you.
Thanks so much for this!
Unfortunately, I have a couple of problems... When the share mounts, it is not in utf-8 format, so folders with odd characters do not show, even though I have that preference set in Mount Manager!
In addition, the unmount script does not work for some reason. When disabling wifi, I recieve a toast that Tasker got the message and executed my exit task, but there is no toast for the unmount script. I've triple checked for grammatical or directory errors, but there are none. Any idea why the unmount script isn't working?
cavemandaveman said:
Thanks so much for this!
Unfortunately, I have a couple of problems... When the share mounts, it is not in utf-8 format, so folders with odd characters do not show, even though I have that preference set in Mount Manager!
In addition, the unmount script does not work for some reason. When disabling wifi, I recieve a toast that Tasker got the message and executed my exit task, but there is no toast for the unmount script. I've triple checked for grammatical or directory errors, but there are none. Any idea why the unmount script isn't working?
Click to expand...
Click to collapse
To be honest, I completely forgot I ever wrote this. Still, the unmount issue could be due to your busybox version. Have you tried executing the relevant commands at a root enabled terminal? Do they work there?
Moreover, you should understand that I apparently wrote this to be completely independent of "Mount Manager" or any related app and these scripts are dependent only on: busybox, Tasker, and the Execute plugin.
-Mike
mikeserv said:
To be honest, I completely forgot I ever wrote this. Still, the unmount issue could be due to your busybox version. Have you tried executing the relevant commands at a root enabled terminal? Do they work there?
Moreover, you should understand that I apparently wrote this to be completely independent of "Mount Manager" or any related app and these scripts are dependent only on: busybox, Tasker, and the Execute plugin.
-Mike
Click to expand...
Click to collapse
I tried executing from terminal and the mount script works fine, but the unmount does not work. It gives me a "no closing quote" error. I'm pretty noobish when it comes to scripts, but it doesn't look like there are errors in the script itself...
Also, if it is independent of Mount Manager, is there a way to include utf-8 formatting in the script?
Sent from my Galaxy Nexus
mikeserv said:
So I've really grown to like having my local SMB shares from my media server mounted to my Xoom so that I can stream video and/or music or whatever on the fly. I don't like the mountpoints getting all messed up when I leave the network though, and I had less than stellar experiences with both Mount Manager and CIFSManager.
CIFSManager worked, but didn't integrate with Tasker, so I couldn't automate it. Mount Manager (the paid version anyway) came with a Tasker plugin, but I don't think it was fully compatible with the Honeycomb OS and I had a lot of issues with it (called the developer and left a message a few hours after buying it, hopefully I can get a refund for my $2.99).
Then I found the (free!) Locale Execute plugin and decided to just script the behavior I wanted myself. If you have Tasker and local SMB shares as well this could be a good solution for you. Just install the Locale Execute plugin from the market and follow these instructions. I'll post them here because I can't post to the dev section yet, and I'm not really sure if this is dev worthy anyway.
snip...
Click to expand...
Click to collapse
I dont care this post is 5 years old, i dont care that i'm bumping this thread...this little gold brick of information was FINALLY what i needed to figure out how to mount cifs without that "never-gonna-be-updated-ever-ever-again-cifsmanager" apk. I just threw the same basic code into tasker and finally got a mount. thank you! if i was more secure in my manhood, i just might embarrass myself.
the real reason for the bump, instead of mere word wasting, is to help anyone anyone searching for the cifs manager apk, or getting the error "no such device" when trying to mount. The issue is connected to the both the "mount name space separation" in SUPERSU, the old android sdcard permissions and who knows what else.
heres' the code I put into tasker:
su --mount-master -c busybox mount -o username=[USERNAME],password=[PASSWORD],rw,file_mode=0777,dir_mode=0777,iocharset=utf8,context=ubject_r:rootfs:s0 -t cifs //192.168.xxx.xxx/cifsync /sdcard/cifsync
no brackets of course.
that popped it right online, no issues but my kernel provides cifs.io support through synapse settings app. so it was easy to load the module at startup
loogielv said:
I dont care this post is 5 years old, i dont care that i'm bumping this thread...this little gold brick of information was FINALLY what i needed to figure out how to mount cifs without that "never-gonna-be-updated-ever-ever-again-cifsmanager" apk. I just threw the same basic code into tasker and finally got a mount. thank you! if i was more secure in my manhood, i just might embarrass myself.
the real reason for the bump, instead of mere word wasting, is to help anyone anyone searching for the cifs manager apk, or getting the error "no such device" when trying to mount. The issue is connected to the both the "mount name space separation" in SUPERSU, the old android sdcard permissions and who knows what else.
heres' the code I put into tasker:
su --mount-master -c busybox mount -o username=[USERNAME],password=[PASSWORD],rw,file_mode=0777,dir_mode=0777,iocharset=utf8,context=ubject_r:rootfs:s0 -t cifs //192.168.xxx.xxx/cifsync /sdcard/cifsync
no brackets of course.
that popped it right online, no issues but my kernel provides cifs.io support through synapse settings app. so it was easy to load the module at startup
Click to expand...
Click to collapse
in code format so there will be no syntax issues -
Code:
su --mount-master -c busybox mount -o username=[USERNAME],password=[PASSWORD],rw,file_mode=0777,dir_mode=0777,iocharset=utf8,context=u:object_r:rootfs:s0 -t cifs //192.168.xxx.xxx/cifsync /sdcard/cifsync

Attaining root on Crystalview (Wondermedia) NB4-3/5788

Believe it or not, this netbook comes already rooted, but how to access it is hidden. The original adventure is posted below if you're interested,but I'll put the tl;dr up top.
You'll need to side load the app USB Debug by tatibana. This will shortcut to the hidden developer options. Slide the developer options on. You may or may not need to reboot, I was too focused on USB Debug to notice the SuperUser Options... The default is Always Deny. Set to Always Allow, then you can replace with your choice su manager (I installed Chainfire's SuperSU).
That's it. The rest below is my original posts up to this point, including getting a Linux working prior to figuring out root. Enjoy the read.
Edit 2: You can pick up new posts from this point by going directly to post #11.
Original Post:
---
Okay, this one is a bit puzzling and I haven't found any good info in searches. This is an Android netbook with Jellybean. Pointer control is a single point touch pad which makes zooming out on several apps impossible; I wish to attain root so I can install desktop Linux in parallel and use some desktop apps in place of some Android apps. I know I could use something like qemu but I'd rather install root and use arm binaries than take a performance hit using non-root methods.
This netbook comes with an installed su binary and busybox 1.19.4 but trying to invoke su results in
su: uid 10084 not allowed to su
Settings is also a bit crippled; no Developer Options section means no option to invoke USB Debugging. Anyone have any good ideas?
---
Sent from my C5155 using XDA Free mobile app
addendum
There also is no physical volume or photo buttons, and no obvious way to get into fastboot mode. My guess is that the original OS image was made in root mode, then the CV dev created a default user with almost no permissions, then backed it out effectively locking it out of root forever. I have also discovered that the busybox doesn't have access to the network as this user 10084, negating half its usability. No Play Store either (using Amazon instead), though I can (and have) install to my phone and copy to this if necessary.
This has a cool little form factor and I think has so much potential for a cheap device if I could just bust this major barrier. Does anyone know any sh or setuid tricks that might fake this thing into a root mode, or at least manage to give me enough permissions to edit /system files?
system seems to be owned by user 1003 and group 120, if that helps.
---
Mmmmmm, tasty foot...
So apparently this is normal behavior for the stock android su (see guys, I'm learning >P ); only the user shell (and root) can use su. This thing using a shared uid for apps might or might not have an effect, don't know yet. The normal way around it is to adb shell and su in, then overwrite with a custom su binary such as ChainsDD. I don't know if I have that option since there's no USB Debugging option, and I'm too tired to find out tonight. I will update this adventure later.
USB failed, but not anything to do with adb, didn't even get that far. The netbook failed to even register to the desktop (Linux)... lsusb didn't show anything. I don't know if it's a cable thing (tried direct A-A patch and the MiniUSB charge port- charge port predictably didn't support data and neither standard port showed any reaction) or a hardware limitation.
I also took a crack at adb over wifi but as usual it was the catch 22 of needing root to invoke adbd into tcpip to attain root.
Still open to suggestions... please?
---
Sent from my C5155 using XDA Free mobile app
Developer Options?
This is driving me up a new wall. Based on what I have been reading all day, Developer Options are a core function and cannot be removed, only hidden. This thing has not been giving me much confidence in that statement, however. I have been through the settings over and over again with a fine tooth comb and the whole thing eludes me.
This is Android 4.1.1. The 4.2+ trick (7 clicks on Build Number) doesn't work, and it's not in the App settings either, nor is there any sections renamed "Advanced" or the like. It may not be an end-all but I feel it would at least be a step in the right direction. I might be able to use an exploit such as Poot or Framearoot, which are currently ineffective.
I also haven't had any luck with getting into a recovery boot mode, not sure it's possible with this keyboard (I suspect it's soft driven; inactive until the kernel and modules are loaded). This seems to be just one shut down after another. I need more ideas, pointers, whatever. Don't forget, it can also help the next sap stuck with this model...
I decided to not lose sight of my original reasoning and move forward anyway with an app that claims to install Linux without root. I installed Gnuroot Wheezy which taught me some more f'd up things about this netbook but it at least in concept is working. What more things I have learned...
One of the issues with running Linux without root is the inability to use the external SD-card, at least native, because you can't mount an external partition/file that hasn't already been set up in the mount scripts outside of userspace. Gnuroot uses a chroot off the secure asec in /data. With about 3G user space available on this netbook, you'd think that wouldn't be a problem... but it is, because of another setup issue with this netbook...
See, while the external SD card does mount to /sdcard,/mnt/sdcard, that is NOT where Android app setup calls SDcard... there is a so called internal SDcard that is really a fake vfat via fuse mount off /data mounted to /mnt/local. This means it does no good to move my plethora of other apps to the "SD Card," actually, it makes the problem worse on this device. I imagine it was done so you could swap SD cards without affecting your apps, good move for flexibility but poor for expandability.
For those who would try it, that's also a big hint for getting it working. This device does not have access to the Play market*, so you will have to move helper apps from another Android device over. Don't bother with 3rd party repositories, you will not get everything you need. The biggest issue is the WheezyX obb file. It on install ONLY from the Play store will be located in /sdcard/Android/obb/champion.gnuroot.wheezyx/main.2.champion.gnuroot.wheezyx.obb , on this netbook the file must be moved to /mnt/local/Android/obb/champion.gnuroot.wheezyx or it will not be recognized, and because of the play store issue, can't be downloaded and gnuroot will exit with error.
Anyway, so now WheezyX is actually running and I am attempting to install an Openbox/LXDE desktop... the problem I am hitting now is the space limitation... It said it needed about 330 MB space and I had 360MB available on start... I'm now about 1/4 through and the netbook has come to a dead crawl due to... yep, very little space left (about 55 MB free on /data)... WTF! I feel like I am just not meant to win at like anything...
---
*Edit: Once rooted, the play store can be installed to the system partition and does work pretty good.
---
Sent from my C5155 using XDA Free mobile app
Some success with Linux
Well, it took quite a bit of monkeying and persistence but I do have desktop Linux running via the above described method. I found Synaptic was useful for finding packages but as the GNURoot author warned, for the love of all that's holy, use apt-get to actually install the packages. It seems trying to install a desktop environment via Synaptic totally overthrew the system. Also try installing only a few packages at a time and clean up after each one, especially where space is a premium.
What's left now is experimenting with vnc viewers a/o X11 environments. I'm presently using PocketCloud but it doesn't seem to like this keyboard (right shift = 6, no down arrow, Ctrl is sticky- forget combo keys; at least the included soft-keyboard does work, just a productivity killer) and getting a right mouse click is almost impossible, so I want to see if I can do better.
The environment is OpenBox with lxpanel and the background is set with qiv. I am confident now that providing space wasn't such an issue I could run pretty much any basic Linux program I want. I have not tested audio and I already know just being vncserver that motion video is a bad idea; this was mostly proof of concept until I can open up some space. I may now see how far I can take this (e.g. link large trees to the SD card, such as bin directories; since it's already running fake-root, I'm not too worried about user permissions. I may also experiment with fuse).
Edit:
This does not mean I don't still want to get a true root. If nothing else, even if I can't take Linux off the internal storage, root will allow me to force Android apps on to the external SD; either solves the current space issue and thus is still desirable. I'm just not as stuck in the mud now. Ideas still very much appreciated.
Done and done.
Just a quick update to say the project isn't dead, just dormant. I have successfully turned on USB debugging thanks to a shortcut app called "USB Debug" by Tatibana. Thank you
---
Sent from my C5155 using XDA Free mobile app
Framaroot, Universal Androot, and Poot have all failed.
:banghead:
Have yet to see if physical USB will now work... I don't exactly live alone.
---
Sent from my C5155 using XDA Free mobile app
SUCCESS!!!!!
IDFBT! I must have not been paying enough attention before or something, or maybe it was one of the half dozen greyed out options before... not sure, but after I was again unable to connect via direct USB, I decided to double check the developer options to make sure noting was reset by the last reboot.... and there in bright white last in the top section... Superuser Options (set to Always Deny)! I set it to Ask and tested, but it promptly rebooted as soon as I tried to su, and again on that boot, so I had to set to Always Allow. Amazon doesn't have SuperSU and last I knew ChainsDD Superuser is still adrift in the doldrums, so I'll have to sideload (as usual), but, I just wanted to share. This netbook does come rooted, you just need to turn on the hidden developer options, reboot, and go back and allow SuperUser.
Will report more as I progress. Banzai!!!
Adventures in Linux land
Well, I had mentioned before how space was an issue. Thanks in part to Link2SD, I managed to curb that problem.
Problem still though was my base graphical Linux install was taking 1G of my /data space. Since I made 2G available on the Link2SD ext4 (/data/sdext2) partition, I found I had about 1.3G available after moving most apps over, I decided I'd try a manual data move. I was slow with this since I didn't know how Link2SD or the system was going to handle it. That turned out to be a good thing.
When using Link2SD, one thing that should be obvious is to never move essential apps off the internal storage. These would be things like Link2SD itself, a Terminal emulator, and your superuser manager (e.g. SuperSU); basically, things you absolutely cannot lose access to even temporarily.
Okay, so, to test the behavior, I went into the emulator..
su
cd /data/sdext2
mkdir Linux
That's all. I then did a normal power off and restart. When rebooting, an "Android is Updating..." box came up and went away in a few seconds. The launcher came up and I waited for everything to load normally. Then I started getting a rash of "App is not installed" messages... uh oh. The only reason this turned out to not be a big deal is Link2SD and SuperSU were still on internal storage, and Link2SD is designed to deal with this problem. I simply launched Link2SD, clicked the tab bar on the upper left, and selected "Relink all application files," after which it requested a reboot, and I complied.
With a semi-disaster averted, I went back into /data/sdext2 to see if the Linux directory was still there. Hallelujah it was. Next was finding the GNURoot wheezyx root. This turned out to be fairly easy:
/data/data/champion.gnuroot/app_install/roots/wheezyx . I decided for potential future expansion to move the whole roots directory. Being cautious as I try, I do a copy.
su
cd /data/data/champion.gnuroot/app_install
cp -a roots /data/sdext2/Linux/
(... go make a sammich ...)
rm -R roots
(... go make and eat dinner ...)
ln -s /data/sdext2/Linux/roots roots
This appeared to work at first, until I tried to install something (abiword). I discovered that the permissions were not copied to the lib directories (android security quirk?). This would probably not be an issue if this were a true root install but being a fake root app install, it effectively prevented the installation of libraries. This was fixed simply by doing a chown and chmod on the lib directories.
Contined from above:
cd roots/wheezyx
chown 10102.10102 lib
chmod 771 lib
chown 10102.10102 usr/lib
chmod 771 usr/lib
*note: the app id number may be different on your copy. This will be fairly obvious with a simple ls -lh .
After that, the install completed and this thing is running pretty good. I am now considering this a complete success. While technically solved, I'll keep this thread open for questions or updates (for as long as the mods don't mind).
---
Sent from my C5155 using XDA Free mobile app
Screencap op
Assuming the uploads work this time, attached are some screencaps. Enjoy.

[GUIDE][HOWTO] Setup 2way-sync over WiFi using Unison

There are a lot of howtos about pulling/pushing content over wifi around. Taking adb or AirDroid may be reliable for common use, but i was looking for a real two-way-sync without utilizing a cloud, also i wanted not too much 3rd Party-Software involved, neither on my box nor at my phone.
Although Unison is platform-independant and can be run from Windows, i'm focussing on the Linux part (coz i've got no Windows box to test). I won't go deeper into things like howto install the required applications on your box. You won't have to compile anything, precompiled binaries should be available for your distro. Guess pacman, yum and apt-get will do their job, but if in doubt, Google will lead the way.
Requirements
A rooted device
SSHDroid installed on your Android
OpenSSH, SSHFS and Unison properly installed on your Box
SSH
After ensured the requirements above, you should be able to ssh to your android device. It's ip is shown by SSHDroid.
Code:
ssh [email protected]<yourdeviceip>
First connect will take some time, coz ssh will handshake your device and save the fingerprint. After the connect succeeded, you will be easily able to connect your device anytime over wifi.
SSHFS
SSHFS allows us to mount the whole android device to a mountpoint on your box. Compare it like a external harddisk you plug into your box usb.
First we'll create a directory in our home and then mount the device into it.
Code:
mkdir wifidroid && sshfs [email protected]<your device ip>:/sdcard/ ~/wifidroid/
SSHFS will ask for your root password anytime you try to connect. If not configured different within SSHDroid, it will be admin. You're ought to change it for safety reasons. After above steps, your device is mounted into wifidroid. You can easily browse the contents using your preferred linux filemanager (like dolphin or nautilus). To unmount device, use fusermount -u ~/wifidroid/ later.
UNISON
Unison will handle the syncing between your box and your device. It comes with an cli and even with a gui. Whatever you will use is up to your personal preference.
First of all we're going to create the unison profile directory and a basic example profile for syncing pictures.
Code:
mkdir ~/.unison && touch pictures.prf
Open pictures.prf with your preferred editor (nano, vi, kate, gedit, orwutevah) and write down some config stuff.
Code:
root=/home/<username>/Pictures
root=/home/<username>/wifidroid/Pictures
path=Friends
path=Landscape
path=Misc Stuff
perms=0
ignore=Name .*~
ignore=Name *~
ignore=Name .*
The first root=/home/<username>/Pictures points to your local pictures directory, whereas the second one, root=/home/<username>/wifidroid/Pictures points to the pictures-folder at your mounted android device. Unison syncs recursevly, so it would simply sync anything beneath the directory Pictures. If you want to sync only some Subfolders, use path=Friends i. e. to include Pictures/Friends. You may edit this to your own convince. We don't want unison to set permissions on synced files, so we set perms=0. Rest should be self explanatory.
Okay, now just fire up unison with unison pictures for cli-version, or unison-gtk pictures for the gui-version and syncing should begin.
Keep in mind that, depending on your wifi speed, it will take a huge amount of time to sync a whole mp3/picture library for the first time. After first sync things should be butter smooth
Above example is just a basic profile. You can easily use unison to backup your whole device, or, as i do, make regular backups of your Camera-Roll, WhatsApp and Threema Backups. If you wanna go deeper into this, you should take a look at the Unison Reference Guide.
Genericxx said:
There are a lot of howtos about pulling/pushing content over wifi around. Taking adb or AirDroid may be reliable for common use, but i was looking for a real two-way-sync without utilizing a cloud, also i wanted not too much 3rd Party-Software involved, neither on my box nor at my phone.
Although Unison is platform-independant and can be run from Windows, i'm focussing on the Linux part (coz i've got no Windows box to test). I won't go deeper into things like howto install the required applications on your box. You won't have to compile anything, precompiled binaries should be available for your distro. Guess pacman, yum and apt-get will do their job, but if in doubt, Google will lead the way.
Requirements
A rooted device
SSHDroid installed on your Android
OpenSSH, SSHFS and Unison properly installed on your Box
SSH
After ensured the requirements above, you should be able to ssh to your android device. It's ip is shown by SSHDroid.
Code:
ssh [email protected]<yourdeviceip>
First connect will take some time, coz ssh will handshake your device and save the fingerprint. After the connect succeeded, you will be easily able to connect your device anytime over wifi.
SSHFS
SSHFS allows us to mount the whole android device to a mountpoint on your box. Compare it like a external harddisk you plug into your box usb.
First we'll create a directory in our home and then mount the device into it.
Code:
mkdir wifidroid && sshfs [email protected]<your device ip>:/sdcard/ ~/wifidroid/
SSHFS will ask for your root password anytime you try to connect. If not configured different within SSHDroid, it will be admin. You're ought to change it for safety reasons. After above steps, your device is mounted into wifidroid. You can easily browse the contents using your preferred linux filemanager (like dolphin or nautilus). To unmount device, use fusermount -u ~/wifidroid/ later.
UNISON
Unison will handle the syncing between your box and your device. It comes with an cli and even with a gui. Whatever you will use is up to your personal preference.
First of all we're going to create the unison profile directory and a basic example profile for syncing pictures.
Code:
mkdir ~/.unison && touch pictures.prf
Open pictures.prf with your preferred editor (nano, vi, kate, gedit, orwutevah) and write down some config stuff.
Code:
root=/home/<username>/Pictures
root=/home/<username>/wifidroid/Pictures
path=Friends
path=Landscape
path=Misc Stuff
perms=0
ignore=Name .*~
ignore=Name *~
ignore=Name .*
The first root=/home/<username>/Pictures points to your local pictures directory, whereas the second one, root=/home/<username>/wifidroid/Pictures points to the pictures-folder at your mounted android device. Unison syncs recursevly, so it would simply sync anything beneath the directory Pictures. If you want to sync only some Subfolders, use path=Friends i. e. to include Pictures/Friends. You may edit this to your own convince. We don't want unison to set permissions on synced files, so we set perms=0. Rest should be self explanatory.
Okay, now just fire up unison with unison pictures for cli-version, or unison-gtk pictures for the gui-version and syncing should begin.
Keep in mind that, depending on your wifi speed, it will take a huge amount of time to sync a whole mp3/picture library for the first time. After first sync things should be butter smooth
Above example is just a basic profile. You can easily use unison to backup your whole device, or, as i do, make regular backups of your Camera-Roll, WhatsApp and Threema Backups. If you wanna go deeper into this, you should take a look at the Unison Reference Guide.
Click to expand...
Click to collapse
Thanks will try
Nice job mate. I will try it.
Thanks @Genericxx, it looks complicated at first, but after reading a while it makes complete sense,
For anyone who wants an easier way for syncing between PC windows and Android, i'd recommend ES File Explorer and Goodsync (on windows PC)
First enable FTP Remote manager in ES through a WiFi same with ur PC windows. Then open Goodsync and setup a sync wizard and choose FTP and then the ip address from ES on the Right (destination)sync folder.
It works great on the Note 2 and it is awesome app! 5 star on market and thanks here.
No need to be root
Great guide, thanks a lot!
I have two things to add.
1. You do not need to root your Android device to use SSHDroid.
2. As the user of a non-rooted device, I ran into the problem of permissions when using unison. The solution:
Apart from having the
perms = 0
line in your .prf file, also add
dontchmod = true
So, my file looks like this:
Code:
perms=0
dontchmod = true
root=/home/<username>/Pictures
root=/home/<username>/wifidroid/Pictures
ignore=Name .*~
ignore=Name *~
ignore=Name .*
Placing "perms=0" and "dontchmod = true" at the beginning of the file may be important (I read it somewhere), but maybe it is not.
And it works nicely with my non-rooted device. Thanks again!
Check also UnisonSync:
https://play.google.com/store/apps/details?id=net.danielroggen.unisonsync
It's a Unison client for Android with GUI.
The advantage of unison client (rather than server) on the answer Android device is that you can connect to your server even if your shoe Android device is on a different subnet or behind a firewall (as long as your server is accessible of course).
Cheers,
D.

Question about FUSE mount points and multiple user accounts

I have an old lg pad 7 running cyanogen 12 that I use to mess around. I have two user accounts; both have root through SuperSu.
I recently discovered that even though both user storage directory mount points are accessible in terminal from both user accounts, this is no longer the case after running su due to the FUSE kernel module.
What I don't understand is that only emulated/0 (the primary user directory) is available with su no matter what account I use to run the terminal. In other words, when I run su from the terminal in the secondary user account, emulated/11 disappears as though I am still using the primary account.
I assume this is a quirk of android multiuser as it was never really intended to be used like this. I'm still curious about what's actually going on and if there is a way to override it. If anyone could explain the issue in greater detail it would definitely be appreciated.

Categories

Resources