Reset Password Failed 2022 for LTS NVR

Forgot password to LTS or HikVision NVR (Network Video Recorder), cannot remember template pattern to login to NVR as admin.

In order to recover the NVR password you would need to have physical access to the recorder and have it connected it to a network.

In order to access NVR via network, download SADP Tool from

Once installed, scan the network and you’d see your NVR on the list. You will find the NVR’s IP address. If the IP is dynamic, you can try connecting to it using SADP Tool. Click on the list to have is highlighted/selected and on the bottom right click Recover password.

Important: make sure you can leave the laptop running till the very end (keep reading) without disconnecting.

Should you encounter an error, change configuration of your laptop/computer to match IP network, but in your computer’s network settings make Gateway be your NVR’s IP address. For example: if you NVR network settings are:
IP:, Mask:, Gateway:

Change your computer’s network configuration to:
IP:, Mask:, Gateway:

DNS servers are not important in this case.

Once you are connected to the NVR, the main point is to export an XML file and have it sent to LTS’s technical/customer support. They’d send you another XML file back to you and you would have to import it into the NVR in order to reset the admin password.

When importing the file you might encounter different errors:

Failed to reset password. Device denied.
Failed to reset password. Device denied.
Failed to reset password. Other 2015..
Failed to reset password. Other 2015..
Failed to reset password. Other 2022..
Failed to reset password. Other 2022..

After many trials and errors the main solution seems to be:

Leave the computer/laptop and NVR running for the entire duration of the endeavor! Do not disconnect/power cycle the devices, do not turn off SADP Tool, do not disconnect network switches. WAIT until the customer service sends you the final password reset file. The turnaround is normally from an hour to a business day, depending when you catch the support rep.


How do I use the ternary operator ( ? : ) in PHP as a shortcut for “if / else”?

PHP 5+

(condition) ? /* value to return if condition is true */ 
            : /* value to return if condition is false */ ;

syntax is not a “shorthand if” operator (the ? is called the conditional operator) because you cannot execute code in the same manner as if you did:

if (condition) {
    /* condition is true, do something like echo */
else {
    /* condition is false, do something else */

PHP 7+

As of PHP 7, this task can be performed simply by using the Null coalescing operator like this :

// Fetches the value of $_GET['user'] and returns 'nobody'
// if it does not exist.
$username = $_GET['user'] ?? 'nobody';
// This is equivalent to:
$username = isset($_GET['user']) ? $_GET['user'] : 'nobody';

// Coalescing can be chained: this will return the first
// defined value out of $_GET['user'], $_POST['user'], and
// 'nobody'.
$username = $_GET['user'] ?? $_POST['user'] ?? 'nobody';

ftp connection via Midnight Commander

Midnight Commander has ability to connect to ftp in a pane, so it’s possible to use it to connect to a remote FTP server.

Go to Shell, execute mc and press F9 to call the menu. Select Left/Right window, select FTP Link

Enter FTP server details in one of the following formats:

username:password@host           #for non-anonymous login;
host                             #for anonymous login;
!username:password@host          #for servers behind the firewall, through proxy servers;
username:password@host:port      #for servers using non std port;
username:password@host/directory #to go to specific directory. 

Once you’ve connected to your remote FTP server, you can copy any files or folders between the panes in your Midnight Commander and any directory on your remote FTP server.


How to delete emails from qmail queue on H-Sphere

First check the status of your queue:

# /var/qmail/bin/qmail-qstat
messages in queue: 6751
messages in queue but not yet preprocessed: 56

After you find and stop the spammer, you now have a bunch of email on your QMail queue. Here’s how to remove it

take a “” that happens in emails from the spammer (usually the sender) and run this command:

grep -R /var/qmail/queue/mess/* | awk -F”:” ‘{print “rm -f ” $1}’ | sh

make sure the quotes and single quotes are straight, not round upon copy/paste

That will delete the emails that contain that

but it would leave behind various indexes and later on your users would start receiving bouncebacks for emails they’ve never sent!


this removes not only messages, but all the mentioning of those messages from everywhere. (sasa4uk)


Hsphere file paths

Socket file: /var/lib/mysql/mysql.sock
Database file: /var/lib/mysql
mysql password file: /var/lib/mysql/.my.cnf
Error log: /var/log/mysql/error.log


Proftpd is default with hsphere.

Configuration file: /hsphere/shared/config/ftpd/proftpd.conf
Log file: /hsphere/local/var/proftpd/xferlog


networking Uncategorized

Cannot Map NAS in Windows 10 Pro x64

I have purchased a D-link DNS 321, and after several hours of trying I could not map the NAS as a drive nor access it using NFS

Objective: use NAS as network file server.

Go to Programs and Features in Windows 10 Control Panel. Click Turn Windows features on or off link.
Scroll down to SMB 1.0/CIFS File Sharing Support and check all of the features. Click OK.
Once all of the installation is done, click Restart now.
In Windows Explorer go to Network => Storage (or whatever your NAS’ name is) and you will be presented with all the Volumes available.

CURL ERROR: SSL certificate problem: self signed certificate in certificate chain (

Recently there was a spike in customers that reported their sites credit card processing errors which, according to log files resulted in the following error produced:

CURL ERROR: SSL certificate problem: self signed certificate in certificate chain


Testing (oneliner):

echo | openssl s_client -connect -showcerts -verify 10 -CAfile /home/path/to/cert.pem

Make sure to replace “/home/path/to/cert.pem” with the real path. If all is good you’ll get something like this at the end:

Verify return code: 0 (ok)

Otherwise you’ll see:

Verify return code: 19 (self signed certificate in certificate chain)