This manual explains how to set up a low-cost NAS server to store videos from a Xiaomi camera, model MI Security Camera.
You can use a development board Linux based such as Raspberry PI or similar, an old PC, Barebone etc.
Install samba.
apt install samba
Create a user without password.
useradd smbcamrec
Create a SMB password from the user.
smbpasswd -a smbcamrec
Recommend: Use an external USB or hard disk to store the videos.
Format the external storage device.
mkfs.ext4 /dev/sdXY
Edit fstab.
cp /etc/fstab /etc/fstab.bak
echo '/dev/sdXY /media/sdXY ext4 defaults 0 0' >> /etc/fstab
Check fstab and mount.
mount -a
Edit the /etc/samba/smb.conf configuration file with the smb.conf file below.
Check the configuration.
testparm
Make the mount directory and change propietary and group.
/media/sdXY/smb/smbcamrec/cam01
/media/sdXY/smb/smbcamrec/cam02
chown -R smbcamrec:smbcamrec /media/sdXY/smb/smbcamrec
Restart service.
systemctl restart smbd.service
Open the Xiaomi Home app in your smartphone and configure the NAS server.
NOTE: The camera and the samba server must be on the same LAN.
Install the cifs-utils package.
apt install cifs-utils
Mount the NAS shared folder (replace the NAS_SERVER_IP_ADDRESS).
mkdir -p /media/smb/smbcamrec
mount -t cifs -o user=smbcamrec //NAS_SERVER_IP_ADDRESS/smbcamrec /media/smb/smbcamrec
Enjoy! :)