Reputation: 41
I would like to know there is methods to export user lists and passwords in synology NAS device
Upvotes: 3
Views: 16725
Reputation: 2119
See user Greenstream's answer in the Synology Forum:
- Download config backup file from the Synology
- Change file extension from .cfg to .gzip
- Unzip the file using 7-Zip or another utility that can extract from gzip archives
- Download and install DB Browser for SQL LIte from http://sqlitebrowser.org/
- Open the extracted ‘_Syno_ConfBkp.db’ file in DB Browser for SQL Lite
- From the top menu bar select File, then Export, then Export as csv
- In the export dialog select the table confbkp_user_tb
- 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)’
- Save the file to your desktop and open in Excel
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