Video address:
Start#
Recently, I discovered a very good SMB backup software called FolderSync. Earlier, I was also backing up my photo directory by connecting my computer via a data cable.
Due to financial constraints, I do not have a branded NAS at home, so I set up a SAMBA service on my soft router to store some movies and shared resources...
Today, let's tinker with it.
We can download this software from the Google Play Store, and I have also prepared an APK package for easy download.
LanZou Cloud Password: 5cgt
If you have the ability, you can download it for free from the Play Store. The version on LanZou Cloud is a green version, and the blogger is unsure if there are any security risks.
After downloading, open the software, and you will see that it requires us to grant permissions to function properly. It is recommended to enable all suggested items.
Since the system UI settings may differ, agree to each one in the software.
Enter the software and find the account option at the bottom bar, click Add Account
, and you will see many account types; this is not the main point.
Scroll to the bottom to find SMB2. Why not choose SMB1? From my testing, SMB1 cannot be used no matter how it is set up. If SMB2 also does not work, you can allow ports 445
and 139
through the firewall.
I am using the Baota Linux panel to allow the ports.
Allow Firewall#
In the terminal, enter sudo apt-get install iptables-persistent
.
During installation, it should ask whether to add IPv4 and IPv6 rules; answer Yes
to both.
After installation, return and enter;
iptables -I INPUT -p tcp --dport 445 -j ACCEPT && iptables -I INPUT -p tcp --dport 139 -j ACCEPT
Enter sudo netfilter-persistent save
to save.
This way, the ports are successfully allowed.
Security issue: If you are on the external network, you need to forward the ports to the public network. If you are not exposed to external network services, you can directly turn off the firewall. It is not recommended to expose SMB ports publicly as they can be attacked. You can use plugins in OpenWrt to set up a reverse proxy. This may be explained in a separate issue later; it is indeed very simple, so I won't keep you in suspense.
It's just about finding a domain for DDNS, then opening and forwarding the ports, and enabling reverse proxy. Remember to enableAccept LAN Access
, then set up a global proxy in the mobile app to access internal network services from the external network, as long as your proxy password and ports are not overly exposed, this is safe.
Setting Up SAMBA Service#
If you haven't set up the SAMBA service, here's a brief explanation.
Here, the user is miaoer
and the shared name is nas
. Set the username and service name, and location; please replace it with your preferred format.
useradd miaoer // Create a new username miaoer
sudo apt-get install samba // Install samba with administrator privileges
sudo smbpasswd -a miaoer // Set the samba username and password for miaoer
cd / && mkdir nas // Return to the root directory and create the nas shared folder
chmod 777 nas // Grant 777 permissions to the folder
You can find a way to edit the configuration file and upload it, or use the vim command. Press i
to edit, then press Esc
followed by Shift + :
until you enter :wq
to exit.
[nas]
comment = nas
path = /nas
browseable = yes
writable = yes
file mode = 660
force file mode = 660
directory mode = 770
force directory mode = 770
Software Settings#
Alright, back to the main topic. In SMB2 settings, enter the username and password you just set during login.
For the connection, enter the host address where SAMBA is deployed on the internal network, and the port number can be left as default. Enter the shared name you just set for the folder.
Then click save.
Next, go to the left side Folder Pair
, create a folder pair and select SMB2.
Here, you can see many options.
For sync type, I only need to choose to the remote folder.
Click on the remote folder. Since there is no dedicated folder for backup, create a new one. I set it as the Mi10 folder; you can name it whatever you like.
After creating it, click into it and check the box at the bottom right.
For the local folder, the album is in DCIM
. Click in and check the box; you can perform a test first.
Original Image#
Alright, we have no issues now. Back on the homepage, we still cannot click the sync button; we need to do a few more steps. First, open settings, find the album in cloud services, and select to automatically download original images
.
Click to sync immediately, and we return to enable fast sync
so that downloading the original images will be faster.
Alright, I have run it for a while and finally pulled back the cloud service's album. Let's continue.
Click on Sync
, return to the app's homepage to check the sync status. If it is running, it means everything is normal. Next, we will set up a scheduled task according to your personal habits. I set a custom time, which is the backup time during sleep.
However, make sure that FolderSync has auto-start permissions and that power-saving strategies are turned off; otherwise, all previous settings will be in vain.
This article is synchronized and updated to xLog by Mix Space. The original link is https://www.miaoer.net/posts/blog/app-foldersync