Video address:
Start#
Recently, I discovered a very good SMB backup software called FolderSync. Earlier, I was backing up my photo directory by connecting my computer with a data cable.
Due to financial constraints, I don't 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 can, 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 security risks.
After downloading, open the software. You will see that it requires 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.
Once in the software, find the account section at the bottom, click Add Account
, and you will see many account types, which are not the focus here.
Scroll down to see SMB2. Why not choose SMB1? From my testing, SMB1 cannot be set up to work. If SMB2 also doesn't work, you can allow the firewall for ports 445
and 139
.
I am using the Baota Linux panel to allow the ports.
Allowing the Firewall#
In the terminal, enter sudo apt-get install iptables-persistent
.
During installation, it should ask whether to add IPv4 and IPv6 rules; answer both with Yes
.
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 as they can be attacked. You can use plugins in OpenWRT for reverse proxy; this may be explained in a separate issue later. It is indeed very simple, so I won't keep you in suspense; just find a domain for DDNS, open and forward the ports, and enable reverse proxy. Remember to enable
Accept 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 port 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 uses miaoer
and shares nas
to set the username and service name, location; please replace it with your preferred format.
useradd miaoer // Create a new username miaoer
sudo apt-get install samba // Install samba with admin 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#
Okay, 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 remain default. Enter the shared folder name you just set.
Then click save.
Next, go to the left side Folder Pair
, create a folder pair and select SMB2.
In here, you will 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, but you can name it whatever you like.
After creating it, click inside, and check the box in the bottom right corner.
For the local folder, the album is in DCIM
, click inside and check the box to test it first.
Original Image#
Alright, we have no issues now. Back to the homepage, we still can't click the sync button. We need to do a few more simple 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.
Okay, I ran 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 while sleeping.
However, make sure FolderSync has auto-start permissions and that the power-saving policy is turned off; otherwise, all the 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