[SOLVED] Mount a smb/cifs share

Search This thread

sendan

Senior Member
Dec 24, 2009
589
111
Appleton
Thank you in advance if you can help with this, unfortunately I'm not going to be able to follow through with this very well at the moment. If this gets no attention I'll bump it when I can follow through. :)

I want to mount a smb/cifs share from my router to my Nexus 5.

I can successfully mount the share and view it in terminal but none of it shows up in any apps...and that's pretty much my issue.


Here's some unimportant info, and a little info about me, I'm as scatterbrained as they come. The reason I want to do this is to stream my movies on the "NAS" to my Chromecast through Allcast or something.

As of now I'm using an entware mini dlna package on the router to stream everything to Avia. My problem is dlna broadcasts all my media to my entire network...no password required or anything. Also accessing my files through Avia is a pain in the ass, navigating through the folders repetitively gets exhausting.

Here's what I've come up with so far:

I'm using hammerhead-faux123-010m kernel, and SlimRC3.

CIFS DebugData:

Code:
CIFS Version 1.78
Features: posix xattr
Active VFS Requests: 0
Servers:
1) Name: 192.168.1.1  Domain: WORKGROUP Uses: 1 OS: Unix
NOS: Samba 3.0.37	Capability: 0x80e3fd
SMB session status: 1	TCP status: 1
Local Users To Server: 1 SecMode: 0x3 Req On Wire: 0
Shares:
1) \\192.168.1.1\NAS Mounts: 1 Type: NTFS DevInfo: 0x0 Attributes: 0xf
PathComponentMax: 255 Status: 0x1 type: 0 

MIDs:

The disk is actually Ext3, not NTFS.

This guy kinda just crushed all my hopes and dreams of the future but I'm trying to use his OneClickMount alpha app.
http://xdaforums.com/showpost.php?p=49651026&postcount=127

app here:
http://xdaforums.com/showpost.php?p=49693815&postcount=129

This is what I have tried, I ended up with the same results:

Code:
root@android:/storage/emulated/0/cifs # setenforce Permissive
root@android:/storage/emulated/0/cifs # getenforce
Permissive
root@android:/storage/emulated/0/cifs # mount -r -o noperm,rw,file_mode=777,dir_mode=777,uid=1023,gid=1023,unc=\\\\192.168.1.1\\NAS,username=***,password=*** -t cifs none /storage/emulated/0/cifs
root@android:/storage/emulated/0/cifs # ls
My Music
My Pictures
My Videos
Torrents

Then I tried OneClick Mount app:

https://www.dropbox.com/sh/muabb9vp1i8ubxt/o78FSYMcHo

From what I can tell from the app logcat, the app tries to move the debuggered file, create its own with a chosen command inside, start then stop it, and restart the original.

I might try to do this manually later, as in a month from now at the least. I'm pretty sure a certain someone is pissed off at me for not becoming one with the universe n all that jazz.
 
Last edited:

3DSammy

Senior Member
May 5, 2011
1,252
617
Toronto
Sorry but as of android 4.4.2 CIFS at a device level (all accounts see the network shares) no longer works and no one has a solution. This includes rooted devices and custom Roms. Of course apps such as ES File Explorer can have network share accesses but not all apps can utilize that access. For example MX player can be invoked from an ES file folder by clicking on a video file but apps like PowerAmp cannot see those folders. Some apps include built in network share features but they have the same restrictions as I previously described.

Things all changed when Android included multiple accounts and security started to get tighter. Initially developers found ways around those measures but too my knowledge, with 4.4.2 no one has found a work around.

Sent from my Nexus 10 using XDA Premium HD app
 

danarama

Senior Member
Aug 22, 2010
31,277
18,811
Oxenhope, West Yorkshire, UK
Things all changed when Android included multiple accounts and security started to get tighter. Initially developers found ways around those measures but too my knowledge, with 4.4.2 no one has found a work around.

Sent from my Nexus 10 using XDA Premium HD app


One workaround is hijack a system process such as debuggerd (debugger daemon) which runs with higher than su permissions. This method still works but is awkward to exploit manually. Apps such as foldermount use this workaround but not for network mounting, but it shows that it is still possible.
 

embhorn

Senior Member
Apr 28, 2012
93
9
I have a Raspberry Pi running OpenELEC for streaming my locally stored media. I use my Chromecast for streaming Netflix, Google Play media, etc.

I understand what you are trying to do, but a dedicated device works great for me.

That said, you might keep an eye on VLC to see if they start supporting casting to Chromecast. That would likely accomplish what you are asking.
 

sendan

Senior Member
Dec 24, 2009
589
111
Appleton
One workaround is hijack a system process such as debuggerd (debugger daemon) which runs with higher than su permissions. This method still works but is awkward to exploit manually. Apps such as foldermount use this workaround but not for network mounting, but it shows that it is still possible.

This is what I'm going to attempt next, from what I read it can be terribly inconsistent if not done through SSH, so that's a bummer. I just need to get more information on how to do it. Debuggered in general confuses me.

I have a Raspberry Pi running OpenELEC for streaming my locally stored media. I use my Chromecast for streaming Netflix, Google Play media, etc.

I understand what you are trying to do, but a dedicated device works great for me.

That said, you might keep an eye on VLC to see if they start supporting casting to Chromecast. That would likely accomplish what you are asking.

This is what I've been wanting to do with my old Galaxy Nexus. I have the HDMI adapter and everything but the screen is broke (the digitizer works), so I plug it into my TV and randomly hit the screen hoping to eventually connect my bluetooth mouse lol. No such luck. I wish I could just boot it into a custom build but that's never gonna happen. Unless OpenELEC works on android devices? Seems unlikely.
 

danarama

Senior Member
Aug 22, 2010
31,277
18,811
Oxenhope, West Yorkshire, UK
debuggerd can be replaced with a shell script with the mount command in it and it will run at boot.

It's really messy. I found I had to put the original debuggerd back or the phone would lock up.

Sent from my Nexus 5 using Tapatalk
 
  • Like
Reactions: sendan

sendan

Senior Member
Dec 24, 2009
589
111
Appleton
WEEEEEOOOOOOO I finally got all my stuff to show in a file manager, now I just need to find a terminal command to trigger media scan on the folder. Right after I eat a bunch of chicken.

Awesome, it works perfectly. And by perfectly I mean it's the messiest thing I've ever done on Android. I'm not really sure how this affects battery and all but thank god this finally works.
 
Last edited:

sendan

Senior Member
Dec 24, 2009
589
111
Appleton
For anyone interested:

Follow the directions in this post.

I didn't understand the mount command he used so I used

Code:
/system/xbin/busybox mount -r -o noperm,rw,file_mode=777,dir_mode=777,uid=1023,gid=1023,unc=\\\\192.168.1.1\\NAS,username=***,password=*** -t cifs none /data/media/0/cifs

You also need to use /data/media/0/ otherwise it will only work in already opened apps apparently.

So thanks rootSU...And that should work, I'm going to do it in a way where I don't have to use scriptmanager but that's the gist. All the credit goes to the people in the threads I linked, I have absolutely no idea what I did here and I learned nothing. :eek:

Nothing special to see here. :good:
 

sendan

Senior Member
Dec 24, 2009
589
111
Appleton
Here's a way to unmount it so it doesn't explode your apps when you disconnect WiFi:

/system/bin/debuggerd.binnn

Code:
#!/system/bin/sh
/system/bin/umount_movies.sh
exec /system/bin/debuggerd.bin "$@"

/system/bin/umount_movies.sh

Code:
#!/system/bin/sh
/system/xbin/busybox umount /data/media/0/cifs
/system/xbin/busybox umount -r -o noperm,rw,file_mode=777,dir_mode=777,uid=1023,gid=1023,unc=\\\\192.168.1.1\\NAS,username=***,password=*** -t cifs none /data/media/0/cifs

Script_eject.sh

Code:
#!/system/bin/sh
mount -o rw,remount /system
sleep1
/system/xbin/busybox mv /system/bin/debuggerd /system/bin/debuggerd.binn
sleep 1
/system/xbin/busybox mv /system/bin/debuggerd.binnn /system/bin/debuggerd
sleep 1
mypid=$(/system/xbin/busybox ps -o pid,comm | /system/xbin/busybox grep 'debuggerd' | /system/xbin/busybox awk 'NR == 1 {print $1}')
/system/bin/kill $mypid
sleep 1
/system/xbin/busybox mv /system/bin/debuggerd /system/bin/debuggerd.binnn
sleep 1
/system/xbin/busybox mv /system/bin/debuggerd.binn /system/bin/debuggerd
sleep 1
mount -o ro,remount /system

I'm automating all this with Tasker.

Script task: (I have it run at boot)

waits 15 seconds
run shell command to kill debuggerd
wait 5 seconds
media action scan card /

Script_eject task: (I have it run when I disconnect from my SSID)

run shell command with the script_eject.sh code
wait 6 seconds
media scan card /

It has been seamless so far, also lol.
 

Attachments

  • Tasker_tasks.zip
    1 KB · Views: 133

3DSammy

Senior Member
May 5, 2011
1,252
617
Toronto
For anyone interested:

Follow the directions in this post....

I have yet to try your solution but what Rom and kernel do you have installed? I ask because in the past (Android 4.1) you needed a custom kernel that supported CIFS or you needed to add modules to stock.

I'm using rooted stock, Franco Kernel.

Sent from my Nexus 10 using XDA Premium HD app
 

sendan

Senior Member
Dec 24, 2009
589
111
Appleton
I have yet to try your solution but what Rom and kernel do you have installed? I ask because in the past (Android 4.1) you needed a custom kernel that supported CIFS or you needed to add modules to stock.

I'm using rooted stock, Franco Kernel.

Sent from my Nexus 10 using XDA Premium HD app

I'm on the latest Slim, with latest faux kernel. Faux has cifs modules built in, I'm not sure about Slim or Franco kernel. If you have a cifs folder in /proc/fs I assume that means the kernel has the cifs modules.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    debuggerd can be replaced with a shell script with the mount command in it and it will run at boot.

    It's really messy. I found I had to put the original debuggerd back or the phone would lock up.

    Sent from my Nexus 5 using Tapatalk