Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to export user lists and passwords in synology NAS

Tags:

synology

I would like to know there is methods to export user lists and passwords in synology NAS device

like image 627
Wai Chun Avatar asked Dec 20 '25 03:12

Wai Chun


1 Answers

Local

See user Greenstream's answer in the Synology Forum:

  1. Download config backup file from the Synology
  2. Change file extension from .cfg to .gzip
  3. Unzip the file using 7-Zip or another utility that can extract from gzip archives
  4. Download and install DB Browser for SQL LIte from http://sqlitebrowser.org/
  5. Open the extracted ‘_Syno_ConfBkp.db’ file in DB Browser for SQL Lite
  6. From the top menu bar select File, then Export, then Export as csv
  7. In the export dialog select the table confbkp_user_tb
  8. In the options a. select column names in first line, Field separator character , b. Quote character " c. New line characters ‘Windows: CR+LF(\r\n)’
  9. Save the file to your desktop and open in Excel

LDAP

Based on ldap2csv.py and How to retrieve all the attributes of LDAP database to determine the available attributes, using python-ldap:

#!/usr/bin/python
import ldap

host = 'ldap://[ip]:389'          # [ip]: The ip/name of the NAS, using the default port
dn = 'uid=[uid],cn=[cn],dc=[dc]'  # LDAP Server Settings: Authentication Information / Bind DN
pw = '[password]'                 # LDAP Server Settings: Password
base_dn = 'dc=[dc]'               # LDAP Server Settings: Authentication Information / Base DN

filter = '(uid=*)'  # Get all users
attrs = ['cn', 'uid', 'uidNumber', 'gidNumber', 'homeDirectory', 'userPassword', 'loginShell', 'gecos', 'description']

con = ldap.initialize(host)
con.simple_bind_s(dn, pw)
res = con.search_s(base_dn, ldap.SCOPE_SUBTREE, filter, attrs)
con.unbind()

print(res)

The used ports can be found here.

like image 61
user7217806 Avatar answered Dec 22 '25 18:12

user7217806



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!