[Transfer] Synology NAS CLI Administration Guide
This guide contains command tools that allow your applications to make use of the resources on Synology DiskStation and also includes a list of Synology Error Numbers for reference.
Chapter 1: Introduction
This guide contains command tools that allow your applications to make use of the resources on Synology DiskStation and also includes a list of Synology Error Numbers for reference.
Chapter 2: Synology NAS Administrative Commands
Managing local users — synouser
Synopsis
synouser {--help}
synouser {--add} username passwd full_name expired email app_privilege
synouser {--del} username...
synouser {--rename} old_username new_username
synouser {--modify} username passwd full_name expired email
Description
| Parameter | Description |
|---|---|
--add |
Create one local user at a time |
--del |
Delete existing local user (system accounts admin and guest cannot be deleted) |
--rename |
Rename local user account (system accounts admin and guest cannot be renamed) |
--modify |
Modify the information of a local user account |
Restrictions
username:
- Not case sensitive, limited from 1 to 64 UTF-8 characters
- Excluded symbols:
! " # $ % & ' ( ) * + , / : ; < = > ? @ [ ] \ ^ \{} | ~` - First character cannot be a minus sign or space; last character cannot be a space
passwd:
- Case sensitive, up to 127 displayable characters
- Blank password is allowed
full_name:
- Up to 64 displayable UTF-8 characters, can be empty
expired:
0: Account never expires1: Account has expired
email:
- User email address, can be empty
app_privilege:
- Decimal number for user application access privileges, constructed from the sum of:
- FTP: 0x01
- File Station: 0x02
- Audio Station: 0x04
- Download Station: 0x08
- Example: A user with FTP, Audio Station, and Surveillance Station access has value 21 (21 = 0x01 + 0x04 + 0x10)
Exit Status
Returns 0 on success, or >0 if any error occurs.
Examples
# Change admin password to "1"
DiskStation> /usr/syno/sbin/synouser --setpw admin 1
# Create user syno with password '1', full name 'Synology Inc.', accessible to FTP, File Station, Audio Station, Download Station, and Surveillance Station
DiskStation> /usr/syno/sbin/synouser --add syno 1 "Synology Inc." 0 synology@example.com 31
Managing local groups — synogroup
Synopsis
synogroup {--help}
synogroup {--add} groupname username...
synogroup {--del} groupname...
synogroup {--rename} old_groupname new_groupname
synogroup {--member} groupname username...
Description
| Parameter | Description |
|---|---|
--add |
Create one local group and add specified users to it |
--del |
Delete existing local group (system groups cannot be deleted) |
--rename |
Rename local group (system groups cannot be renamed) |
--member |
Modify the member list of a local group |
Restrictions
groupname:
- Not case sensitive, limited from 1 to 15 UTF-8 characters
- Excluded symbols:
! " # $ % & ' ( ) * + , / : ; < = > ? @ [ ] \{} | ~` - First character cannot be a minus sign or space; last character cannot be a space
Exit Status
Returns 0 on success, or >0 if any error occurs.
Managing share folder information — synoshare
Synopsis
synoshare {--help}
synoshare {--add} sharename share_desc share_path user_list_na user_list_rw user_list_ro share_browsable adv_privilege
synoshare {--del} {TRUE | FALSE} sharename...
synoshare {--rename} old_sharename new_sharename
synoshare {--setuser} sharename {NA | RO | RW} {+ | - | =} user_list
Description
| Parameter | Description |
|---|---|
--add |
Create a new share folder |
--del |
Delete share folder. TRUE: delete all config and data; FALSE: delete config only, manual file removal required |
--rename |
Rename share folder |
--setuser |
Modify the access privilege list of share folder |
Access Privilege Types:
NA: No accessRO: Read-onlyRW: Read/Write
Action Types:
+: Append user list to original privilege list-: Remove user list from original privilege list=: Replace original privilege list with new user list
Restrictions
sharename:
- Not case sensitive, limited from 1 to 32 UTF-8 characters
- Excluded symbols:
! " # $ % & ' ( ) * + , / : ; < = > ? @ [ ] \{} | ~` - First character cannot be a minus sign or space; last character cannot be a space
- Reserved names (cannot use): global, homes, home, printers, ., .., surveillance, usbbackup, usbshare, esatashare
share_path:
- Must be a valid directory path. If path does not exist, synoshare will create it automatically
share_browsable:
1: Show shared folder in “My Network Places”0: Hide shared folder from “My Network Places” (users with proper access can still access directly)
adv_privilege (Advanced Privilege):
- Decimal number, sum of:
- Disable directory browsing: 0x1
- Disable modification of existing files: 0x2
- Disable file downloading: 0x4
Exit Status
Returns 0 on success, or >0 if any error occurs.
Examples
# Create share 'private' with empty access list
DiskStation> /usr/syno/sbin/synoshare --add private "Comment" /volume1/private "" "" "" 1 0
# Add user syno and group stuff with read/write permission to share 'private'
DiskStation> /usr/syno/sbin/synoshare --setuser private RW + syno,@stuff
Managing network settings — synonet
Synopsis
synonet {--help}
synonet {--dhcp} iface
synonet {--manual} iface ip mask [--dont restart service]
synonet {--set_gateway} gateway
synonet {--set_dns} dns
synonet {--set_mtu} iface MTU
synonet {--set_hostname} hostname [--dont restart service]
Description
| Parameter | Description |
|---|---|
--dhcp |
Set network adapter to DHCP |
--manual |
Set network adapter to Manual IP with IP and mask |
--set_gateway |
Manually assign default gateway |
--set_dns |
Manually assign DNS server |
--set_mtu |
Set MTU value of network adapter |
--set_hostname |
Modify server hostname |
Restrictions
iface (Network Interface):
- Only
eth0oreth1(eth1 only supported on NAS with two LAN ports)
hostname:
- Not case sensitive, limited from 1 to 15 displayable characters
- Can contain letters, numbers, underscores, and minus signs
- First character must be a letter
MTU:
- Allowed values: 1500, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000
- Only effective when DiskStation is connected to Gigabit network
Exit Status
Returns 0 on success, or >0 if any error occurs.
Examples
# Set eth0 to manual IP: IP=192.168.14.64, Netmask=255.255.0.0
DiskStation> /usr/syno/sbin/synonet --manual eth0 192.168.14.64 255.255.0.0
DiskStation> /usr/syno/sbin/synonet --set_gateway 192.168.15.254
DiskStation> /usr/syno/sbin/synonet --set_dns 192.168.252.254
# Set new hostname to cn406e
DiskStation> /usr/syno/sbin/synonet --set_hostname cn406e
Managing setting of services — synoservice
Synopsis
synoservice {--help}
synoservice {--list} [running]
synoservice {--enable | --disable} service...
synoservice {--start | --stop | --restart} service...
synoservice {--keyon | --keyoff} service...
synoservice {--detail} service...
Description
| Parameter | Description |
|---|---|
--list |
List all available services; specify running to list only currently running services |
--enable/disable |
Enable/disable service and immediately start/stop it |
--start/stop/restart |
Start/stop/restart service without modifying settings |
--keyon/keyoff |
Enable/disable service settings without interrupting service |
--detail |
Display all information related to specified service |
Available Services
web (Web Station), photo (Photo Station), netbkp (Network Backup), download (Download Station), media (DLNA), audio (Audio Station), itunes (iTunes), mysql (MySQL), printer (Printer), surveillance (Surveillance Station), userhome (User Home), ftp (FTP), telnet, ssh, nfs, afp (Apple File Protocol), samba (CIFS), filestation (File Station), https (HTTPS)
Exit Status
Returns 0 on success, or >0 if any error occurs.
Examples
# Enable SSH service
DiskStation> /usr/syno/sbin/synoservice --enable ssh
# Enable SSH in ds_configure.sh during group install (use --keyon instead of --enable, as services are not started yet)
# ds_configure.sh
/usr/syno/sbin/synoservice --keyon ssh
Managing workgroup or ADS domain setting — synowin
Synopsis
synowin {--help}
synowin {--joinWorkgroup} workgroup
synowin {--joinDomain} {short_domain_name | full_domain_name} username password [-d dns_ip] [-i kdc_ip] [-n netbios_name] [-f fqdn_name]
Description
| Parameter | Description |
|---|---|
--joinWorkgroup |
Join workgroup |
--joinDomain |
Join ADS domain (requires Domain Administrator account) |
Restrictions
workgroup:
- Length 1 to 15 characters
- Excluded characters:
[ ] ; : " < > * + = \ / | ? , - Note: If workgroup name contains
&, Mac OS 10.4.4 and earlier users cannot connect via samba
domain_name:
- Domain with period (e.g.,
synology.com) is treated as full domain name - Domain without period (e.g.,
synology) is treated as short domain name
kdc_ip (Domain Controller IP):
- Can specify multiple DC IPs, separated by commas
- Add
*after last IP for failover
Exit Status
Returns 0 on success, or >0 if any error occurs.
Chapter 3: Synology Error Numbers
Error Numbers Table
| Symbol | Value | Description |
|---|---|---|
| ERR_SUCCESS | 0x0000 | The operation was successful |
| ERR_NOT_ENOUGH_MEMORY | 0x0100 | Insufficient memory allocation |
| ERR_OUT_OF_MEMORY | 0x0200 | The operation ran out of memory |
| ERR_ACCESS_DENIED | 0x0300 | Access is denied |
| ERR_LOCK_FAILED | 0x0400 | Unable to lock a file |
| ERR_UNLOCK_FAILED | 0x0500 | Unable to unlock a file |
| ERR_PATH_NOT_FOUND | 0x0600 | The path not found |
| ERR_FILE_NOT_FOUND | 0x0700 | The file not found |
| ERR_FILE_EXISTS | 0x0800 | The file already exists |
| ERR_OPEN_FAILED | 0x0900 | Failed to open the file |
| ERR_READ_FAILED | 0x0A00 | Failed to read data from specified device |
| ERR_WRITE_FAILED | 0x0B00 | Failed to write data to specified device |
| ERR_CREATE_FAILED | 0x0C00 | Failed to create file or directory |
| ERR_BAD_PARAMETERS | 0x0D00 | The parameters are invalid |
| ERR_INVALID_SERVERNAME | 0x0E00 | The server name is invalid |
| ERR_INVALID_DOMAINNAME | 0x0F00 | The domain name is invalid |
| ERR_INVALID_NETNAME | 0x1000 | The format of IP address is invalid |
| ERR_SERVER_UNREACHABLE | 0x1100 | Failed to locate Windows domain controller |
| ERR_INVALID_SHARENAME | 0x1200 | The share name is invalid |
| ERR_SHARE_EXISTS | 0x1300 | The share already existed |
| ERR_NO_SUCH_SHARE | 0x1400 | The share does not exist |
| ERR_TOO_MANY_SHARES | 0x1500 | The maximum number of shares exceeded |
| ERR_INVALID_GROUPNAME | 0x1600 | The group name is invalid |
| ERR_GROUP_EXISTS | 0x1700 | The group name already existed |
| ERR_NO_SUCH_GROUP | 0x1800 | The group does not exist |
| ERR_TOO_MANY_GROUPS | 0x1900 | The maximum number of groups exceeded |
| ERR_INVALID_USERNAME | 0x1A00 | The user name is invalid |
| ERR_INVALID_PASSWORDNAME | 0x1B00 | The format of password is invalid |
| ERR_USER_EXISTS | 0x1C00 | The user exists |
| ERR_NO_SUCH_USER | 0x1D00 | The user does not exist |
| ERR_WRONG_PASSWORD | 0x1E00 | The password is incorrect |
| ERR_TOO_MANY_USERS | 0x1F00 | The maximum number of users exceeded |
| ERR_KEY_NOT_FOUND | 0x2000 | Failed to find specified keyword |
| ERR_KEY_EXISTS | 0x2100 | The specified keyword already existed |
| ERR_SECTION_NOT_FOUND | 0x2200 | Failed to find the section |
| ERR_SECTION_EXISTS | 0x2300 | The section already existed |
| ERR_NOT_ENOUGH_QUOTA | 0x2400 | Insufficient space with user’s quota |
| ERR_NOT_ENOUGH_VOLUME_SPACE | 0x2500 | Insufficient free space in the volume |
| ERR_SEEK_FAILED | 0x2600 | Seek operation failed |
| ERR_STAT_FAILED | 0x2700 | Stat operation failed |
| ERR_RENAME_FAILED | 0x2800 | Failed to rename |
| ERR_NOT_ENOUGH_SPACE | 0x2900 | Insufficient free space in file system |
| ERR_OP_FAILURE | 0x2A00 | Failed to execute specified operation |
| ERR_DEV_UNCONFIG | 0x2B00 | The device is not ready |
| ERR_DEV_UNMOUNTED | 0x2C00 | The device is not mounted |
| ERR_OP_UNREGISTERED | 0x2D00 | The operation is not allowed |
| ERR_TIMER_EXPIRED | 0x2E00 | The timer has expired |
| ERR_USER_BATCH_CONFLICT | 0x2F00 | Duplicated names found |
| ERR_READ_GEO | 0x3000 | Failed to read geometry from specified device |
| ERR_USAGE | 0x3100 | Invalid usage of parameters |
| ERR_UPDATE_OFFSET | 0x3200 | Illegal offset found while verifying patch file checksum |
| ERR_CHECKSUM | 0x3300 | Illegal checksum of patch file |
| ERR_OPEN_RAWDEVICE | 0x3400 | Failed to open raw device |
| ERR_OPEN_OPTFILE | 0x3500 | Failed to open installation configuration file |
| ERR_READ_RAWDEVICE | 0x3600 | Failed to read data from raw device |
| ERR_WRITE_RAWDEVICE | 0x3700 | Failed to write data to raw device |
| ERR_BADPATCH | 0x3800 | Illegal patch file |
| ERR_REMOVE_FAILED | 0x3900 | Failed to remove file |
| ERR_MOVE_FAILED | 0x3A00 | Failed to move file |
| ERR_COPY_FAILED | 0x3B00 | Failed to copy file |
| ERR_MKDIR_FAILED | 0x3C00 | Failed to create directory |
| ERR_MMAP_FAILED | 0x3D00 | Failed to map file to memory |
| ERR_FORMAT_ERROR | 0x4000 | Failed to make file system |
| ERR_NO_BACKUP_SET | 0x5000 | The backup set does not exist |
| ERR_NO_DEST_ID | 0x5100 | The dest ID in local config does not exist |
| ERR_BACKUP_INFO_FAIL | 0x5200 | Failed to get backup info in shared memory |
| ERR_BAD_DEST_PATH | 0x5300 | The format of local backup destination is invalid |
| ERR_RM_SHM_FAIL | 0x5400 | Failed to remove shared memory ID |
| ERR_EXPORT_APPLICATION | 0x5500 | Failed to export application |
| ERR_IMPORT_APPLICATION | 0x5600 | Failed to import application |
| ERR_NO_VOLUME_ID | 0x6000 | The volume ID cannot be found |
| ERR_NO_DISK_ID | 0x6100 | The disk ID cannot be found |
| ERR_NOT_ENOUGH_SD | 0x6200 | Insufficient hard disks |
| ERR_SD_SIZE_NOT_ALIGN | 0x6300 | Selected hard disks do not have same capacity |
| ERR_DEVICE_BUSY | 0x6400 | Failed to destroy volume because it is occupied |
| ERR_INVALID_SD | 0x6500 | Invalid SD |
| ERR_FORMAT_FAIL | 0x6600 | Failed to reformat the disk |
| ERR_CANNOT_REBUILD_DISK | 0x6700 | Failed to rebuild the disk |
| ERR_BROKEN_RAID_CONF | 0x6800 | Incorrect RAID information |
| ERR_DISK_TOO_SMALL | 0x6900 | The capacity of the disk is too small |
| ERR_CANNOT_GET_MNTINFO | 0x6A00 | Failed to get mount information |
| ERR_BROKEN_DISK_INFO | 0x6B00 | Incorrect disk information |
| ERR_DISK_IO_FAILED | 0x6C00 | Disk I/O fails |
| ERR_BAD_DISK_SECTOR | 0x6D00 | Bad sectors found |
| ERR_UDPD_INVALID_HANDLE | 0x7100 | The specified handle is invalid |
| ERR_UDPD_RUNNING_HANDLE | 0x7200 | The specified handle is busy |
| ERR_UDPD_INVALID_EVENT | 0x7300 | The specified event is invalid |
| ERR_UDPD_INVALID_PARAMETER | 0x7400 | The specified parameters are illegal |
| ERR_UDPD_EXIT_ABNORMAL | 0x7500 | The daemon exits abnormally |
| ERR_UDPD_NOT_ENOUGH_SPACE | 0x7600 | The specified space is not enough |
| ERR_UDPD_TIMEOUT | 0x7700 | Time out before receiving complete packet |
| ERR_UDPD_INIT_FAIL | 0x7800 | Failed to initialize specified handle |
| ERR_UDPD_SEND_FAIL | 0x7900 | Failed to send specified data |
| ERR_UDPD_RECV_FAIL | 0x7A00 | Failed to receive specified data |
| ERR_MANUTIL_PERM | 0x7B00 | The specified burn-in function is invalid |
| ERR_UNKNOWN | 0x8000 | The error cannot be determined |
| ERR_SYS_UNKNOWN | 0x8100 | System encounters an error but function cannot tell the real error |
| ERR_VOLUME_SIZE_TOO_LARGE | 0x8200 | The specified volume size exceeds the limit |
| ERR_VOLUME_NOT_FOUND | 0x8300 | Failed to find the volume |
| ERR_VOLUME_READ_ONLY | 0x8400 | The volume is read only |
| ERR_YP_BIND | 0x9000 | Ypbind error when joining NIS domain |
| ERR_QUOTA_NOT_FOUND | 0x9100 | The user has not been specified with volume quota |
| ERR_QUOTA_PARAM_INVALID | 0x9200 | Quota file is corrupted or command/quota type is invalid |
| ERR_QUOTA_MOUNTING | 0x9300 | Failed to remount file system to enable user/group quota |
| ERR_QUOTA_QUOTACHECK | 0x9400 | Failed to execute quotacheck |
| ERR_QUOTA_QUOTAON | 0x9500 | Failed to execute quotaon |
| ERR_QUOTA_QUOTAOFF | 0x9501 | Failed to execute quotaoff |
| ERR_FORK_FAIL | 0x9600 | Failed to fork |
| ERR_RAID_ENUM_FAIL | 0x9700 | Failed to enumerate system RAID devices |
| ERR_ENUM_FAIL | 0x9800 | Failed to enumerate |
| ERR_INVALID_PATHNAME | 0x9900 | Invalid volume path |
| ERR_SERVICE_EXISTS | 0xA000 | The service already existed |
| ERR_SERVICE_NOT_EXISTS | 0xA100 | The service does not exist |
| ERR_NOT_DIRECTORY | 0xA200 | The specified path is not a directory |
| ERR_DIRECTORY_NOT_EXISTS | 0xA300 | The directory does not exist |
| ERR_SERVICE_NOT_SET | 0xA400 | The service has not been set |
| ERR_IS_DIRECTORY | 0xA500 | The specified path is a directory |
| ERR_PATH_CONFLICT | 0xA600 | Source and destination file are identical |
| ERR_FAT_FILESIZE_TOO_LARGE | 0xA700 | File size exceeds 4GB in FAT file system |
| ERR_FAT_FILENAME_ILLEGAL | 0xA800 | FAT file system contains illegal characters |
| ERR_USER_CANCEL | 0xA900 | Action cancelled by user |
| ERR_INTERRUPTED | 0xAA00 | Interrupted by a signal |
| ERR_ENCKEY_VERIFY | 0xAB00 | Share Encryption: Incorrect encryption key |
| ERR_ENCKEY_LOST | 0xAC00 | Share Encryption: Local copy of encryption key lost |
| ERR_BDB_FILE_DEPRECATED | 0xB000 | The BDB file has been deprecated |
| ERR_BDB_FILE_BAD_FORMAT | 0xB100 | The BDB file is incorrectly formatted |
| ERR_BDB_GET_FAILED | 0xB200 | BDB get failed |
| ERR_BDB_SET_FAILED | 0xB300 | BDB set failed |
| ERR_BDB_DELETE_FAILED | 0xB400 | BDB delete failed |
| ERR_BDB_CURSOR_FINISH | 0xB500 | BDB CursorGet has finished |
| ERR_NO_SUCH_FTYPE | 0xB600 | No such fType value |
| ERR_RESERVED_GROUP | 0xB700 | The gid is less than GID_MIN |
| ERR_RESERVED_USER | 0xB800 | The uid is less than UID_MIN |
| ERR_LOOKUP_DOMAIN_GROUP | 0xB900 | wbinfo -g timeout when building domain group db |
| ERR_LOOKUP_DOMAIN_USER | 0xBA00 | wbinfo -u timeout when building domain user db |
| ERR_INTERFACE_EXISTS | 0xBB00 | The specified interface already existed |
| ERR_NO_SUCH_INTERFACE | 0xBC00 | The specified interface does not exist |
| ERR_TOO_MANY_INTERFACE | 0xBD00 | The interfaces exceeds limitation |
| ERR_INVALID_PATH | 0xBE00 | Invalid path |
| ERR_SIZE_TOO_SMALL | 0xBF00 | The capacity of the disk is too small |
| ERR_NAME_EXISTS | 0xC000 | The name already existed |
| ERR_EXCEED_ISCSI_SIZE_IN_VOLUME | 0xC100 | The reserved size of iSCSI file exceeds the limit |
| ERR_FS_NOT_FOUND | 0xC200 | Failed to find the file system |
| ERR_NAME_TOO_LONG | 0xC300 | File name is too long |
Copyright Notice
© 2015-2021 Synology Inc. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, mechanical, electronic, photocopying, recording, or otherwise, without prior written permission of Synology Inc.