Good day, Habr.
I did not find topics on this topic here, so I decided to write a step by step guide.
So, for a start we will understand what was used.
')
The first is the dd-wrt router.
And the second is a smartphone on android with ssh and samba clients. I used
ConnectBot and
AndSMB .
Configure the router
Ssh server setup
In the section "Services - Services" we include support for ssh. Turn off "Password login" (later we will add the public key in the "Authorized keys"). We set the port at will. Click "Apply settings".

Samba setup
Go to the section “Services - USB” and then turn on “Core USB Support”, “USB Storage Support”, “Automatic Drive Mount”, and set “Disk mount point” - / mnt. Click "Apply settings".

Go to the section "Services - NAS". We include support for samba. Add the ball. Click "Apply settings". We add the user, we register any login, the password and we allow to use to a sphere. Click "Apply settings".

Phone setup
Configure ConnectBot
Go to the "Menu - Manage public keys." Click "Menu - Generate." We write an alias, select the type of the key, the size in bits, optionally the password, and mark “Load the key at the start”.

We give the noise. We are waiting for generation. With a long tap, click on the name and select "Copy public key". This public key must be inserted on the router in the section “Autorized keys”.
We return to the main menu. At the bottom, select the “ssh” connection type, and write root@example.com, where root is the user name and example.com is the name of the host to which we connect. Click to connect.

The program will try to connect, but it will not work, the connection will be interrupted, but it will remain. Now we select it with a long tap and click "Edit Host". Select "Use public key authentication" and select the generated key there.

And at the bottom we correct the username, host and port if necessary.

We return to the main menu and with a long tap we click on this connection, we select “Edit port forwarding”. Click "Menu - Add", write a pseudonym, for example, "Samba", "Type of redirection" - local. “From the port” - here we write down an arbitrary port, greater than 1024 and remember it. "On the port" - example.com:445

Go to setting up AndSMB
Choose "Add". The server address is localhost, the name and password are those that were saved on the router in the “Services - NAS” section.

We go to the tab additionally and write the port that we chose earlier in the ConnectBot program.

Next, go back to the "Basic" and click save. We write the name, for example, “samba over ssh”.
Conclusion
Now we have a samba call through ssh. How it works: We launch a connection in ConnectBot. It should connect. You can check whether the port was forwarded by going to the menu - port forwarding, the port should not be crossed out. Then we collapse the connection by clicking back. Then go to AndSMB and connect to "samba over ssh". Opens the folder that we shared on the router. The same setting can be made if the ball is not on the router, but on the server under Linux: We put the SSH server, add our public key to the allowed keys, share the folder, create user settings for the balls, repeat the steps for the phone and is done.