Monday, February 7, 2022

Setting a SAMBA net HDD on Rapberry PI for HIKVision IP Camera IPC-B120


 HIKVision Value Cameras are affordable CCTV cameras that have amazing features such as internal motion detection, IR night vision and power over ethernet (PoE). Among its available products, there are IPC-B121H which has bult-in H.265+ encoding for saving storage, and IPC-B120-D-W which is a wireless camera with Microphone.

The motion detection feature can be used to avoid recording the whole day, and only record when a motion is detected. 

These cameras need a network HDD to store their recordings. It is possible to create such a net HDD using Raspberry. Pi.

Here is an instruction on how to create a SAMBA net HDD using a raspberry pi. Here is another config that is suggested for HikVision cameras however it does not work either. 

The default configuration does not work on HikVision cameras and the camera returns this error when testing the storage:

Mounting to NAS server failed. Invalid directory or incorrect user name/password.

Samba Error hikvision Pi



The reason for this error is explained here . This can be fixed by adding ntlm auth = yes (required since SAMBA v4.5server min protocol = LANMAN1 (required since SAMBA v4.11) to /etc/samba/smb.conf and restarting the samba server.
In addition, it is possible to add log level = 1 to /etc/samba/smb.conf file to enable logging if it still does not work. If it still does not work, compare the output of testparm -v from an old working version of samba with your version.

The following config in /etc/samba/smb.conf is needed for hikvision to work properly:
[parking]
create mask = 0660
force create mode = 0660
force directory mode = 0770
path = /home/pi/parking
read only = No
valid users = @pi
 Note that the connection information in hikvision camera should be entered like this:
Server Address: Raspberry Pi IP
File Path  (note that it must start with /) : /parking
The username and password needs to be created by using smbpasswd .
With this configuration, it works properly
hikvision pi samba working

It is needed to add a separate partition for the camera on the raspberry pi to avoid the camera making the disk space full.

No comments:

Post a Comment

How to disable Debian 12 sleep on production servers

 Debian 12 has power saver enabled by default which causes your server to go to sleep if there is no mouse / keyboard interaction. To resolv...