Wai Chun
Wai Chun

Reputation: 41

How to export user lists and passwords in synology NAS

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

Upvotes: 3

Views: 16725

Answers (1)

user7217806
user7217806

Reputation: 2119

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.

Upvotes: 4

Related Questions