[Tutorial][Guide]Set up Local and Remote folder mounting using SSH + CIFS

SupremeBeaver

Senior Member
Jun 10, 2010
3,265
308
0
Nicosia
Introduction

For audio enthusiasts like myself, I found myself quite bummed that the GS6 didn’t support expandable storage. This means that I can only fit a fraction of my music library on my phone, and that really bugged me.

So I set out to find a way to connect my music library to my phone, and this tutorial will demonstrate how to do so. In other words, this tutorial will allow you to mount a windows share folder on your phone, either from within the same network, or even remotely! This means you can have your files accessible on your phone as though they are actually on your phone, from anywhere in the world (so long as you have internet of course) and effectively alleviate our limited device storage by 'fooling' our devices into thinking they have unlimited amounts of storage through these mounted folders.

This differs from other more common methods found in some file explorers with SMB (where they allow you to connect to a share), in that this way the folders will be mounted on your phone. Your phone will think that the folder is on it’s storage, which will allow you to use those files in any other app such as music players, video players, ebook readers, etc. Other apps like ES File Explorer etc don't allow this.

I will split this tutorial onto two sections, the first demonstrating how to mount a share on the same network. The second will demonstrate how to mount a share folder from a remote location (i.e from outside your network). The latter method will work with 3G and 4G, heck even G. I will provide screenshots throughout to make it as simple and straightforward as possible.

Requirements for Tutorial 1 (Mount a Share Folder Locally)

• Rooted phone
• Custom kernel with CIFS support (I recommend UniKernel v6 or newer if you're on a GS6, previous versions are unsupported)
CifsManager

Requirements for Tutorial 2 (Mount a Share Folder Remotely)

• Rooted phone
• Custom kernel with CIFS support (I recommend UniKernel v6 or newer if you're on a GS6, previous versions are unsupported)
CifsManager
ConnectBot or similar SSH client
• SSH Server set up on computer with Share folders. My recommendation is freeSHHd

Prerequisite steps

The following steps will need to be carried out on your computer which will have the folder to be shared.

1. Locate or create a folder on your computer you would like to share.

2. Right click on the folder and select Properties. Select the Sharing tab and click Advanced Sharing.


3. Check 'Share this folder'. You can open the Permissions screen to control permissions for certain users.


[Tutorial 1]Mount a Share Folder Locally

The idea behind this method is to simply connect directly to the shared folder over the local network, and mount it.
Having performed the prerequisite steps, carry on below.

1. Launch CifsManager and click Add New Share

2. At Share Path, enter the local IP of your computer, followed by a slash and the name of the shared folder. Your IP can be found in you network settings.

3. If your computer has a username and password, enter those, otherwise this step can be skipped. Notice that Mount Point should be auto filled. This is the location on your phone that the share folder’s contents will appear. In theory, you can change this to a location on the internal storage or SD Card.


4. Click Save Share

8. Your share will appear as below and you can simply click on it to mount it. If the grey dot changes to green, this signifies that the share has been successfully mounted and the files within the share will be accessible at the mount point location.


[Tutorial 2]Mount a Share Folder Remotely

The idea behind this method is that using an SSH server set up on your computer, you will be able to securely connect to your shares over the internet (remotely), and mount them of course.
Having performed the prerequisite steps, carry on below.

1. Set up your SSH Server. I won’t go into detail with this here, but this is a good tutorial to follow if you use freeSSHd. When creating a user though, ensure you tick 'Shell', 'SFTP', and 'Tunneling'. This is not specified in the tutorial, but Tunneling is important for what we want to do.

2. Once installed, and with a user created, ensure that local and remote port forwarding is enabled under the Tunneling tab, and that the port under the SSH tab is open on your router, and not being blocked by your firewall. I recommend leaving the port at 22 since most routers have this port already defined in their lists. You may need to open the port though though your router's web settings.


That should be it on your pc, move over to your phone for the remaining steps. You’ll be using ConnectBot to connect to the SSH server you just set up. You’ll need your username, password, and port number (22 by default) you specified in freeSSHd, as well as you Public IP this time, not your local IP. Just google ‘Public IP’ to get this.

3. Launch ConnectBot, and at the bottom of the screen ensure 'ssh' is selected


4. Enter your username, hostname, and port in the format shown in the above image
So for example, mine is similar to this '[email protected]:22'. Hostname is you public IP which you can find on google. Note, don't use you local IP here otherwise you won't be able to connect remotely to your server.

5. Click enter and you should be prompted to enter your password. Doing so should allow you to connect successfully.


6. Click More at the top of the screen, and select Port Forwards. Select More again and press Add port forward.

7. Enter a nickname of your choice

8. Ensure Local is selected under 'Type'

9. Under 'Source Port' enter a port above 1024. Mine is 5600. Remember this for CifsManager later. It must be above 1024 because of a limitation in Android.

10. Under destination, use the local IP (not public IP!) of your computer running the SSH server, followed by a colon and the port 445. At this step, the port 445 must be used.


11. Click Create Port Forward and it should be smooth sailing from here on out!

12. Launch CifsManager and Add a New Share

13. Under Share Path, enter "127.0.0.1/xxx", without the quotes and replacing xxx with your shared folder name.

14. Enter the username and password of your computer (not SSH server). The mount point should have been auto added. You can change this location if you wish

15. Under Options, write “port=xxx”, without the quotes. Replace xxx with the port number you used in the port forwarding step in ConnectBot (step 9)


16. Click Save Share and that’s it.

Try and mount a share by clicking on it, you should get a green dot meaning all went well. Now you can access your files throughout android, from any network. Note that you will need to be connected to your SSH Server in ConnectBot every time you want to mount a share remotely. Below you can see that I've successfully mounted my remote share, and in the status bar I have a ConnectBot instance running.


So after performing this tutorial, all you will need to do from now on is simply connect to your ssh server in ConnectBot and provide your password, back out of it, and click on your CifsManager share.

Hopefully you found this guide useful. If you have any troubles I'll try my best to help out. Thanks for reading!
 
Last edited:
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone