synology_dsmThe following article describes some basics regarding first contact with Synology DSM shell.

I used DSM 6.1.3 out of the box, running in a Virtual machine (using Virtual Machine Manager) on DS1817+ hardware.

 

 

First, enable the SSH service DSM.
Control Panel > Terminal & SNMP > Enable SSH service
Try not to use Telnet, not even locally (not secure).
PuTTY is a good Windows SSH client.

My test DSM server is called neelix_vm.
My test user is called geohei.

Login using the name and password of the user created during the initial DSM installation process.

login as: geohei
geohei@192.168.1.162's password:
Could not chdir to home directory /var/services/homes/geohei: No such file or directory
geohei@neelix_vm:/$ ls -l /var/services/
total 0
lrwxrwxrwx 1 root root 24 Aug 15 13:41 pgsql -> /volume1/@database/pgsql
lrwxrwxrwx 1 root root 13 Aug 15 13:42 tmp -> /volume1/@tmp
geohei@neelix_vm:/$ pwd
/
geohei@neelix_vm:/$ cat /etc/passwd
admin:x:1024:100:System default user:/var/services/homes/admin:/bin/sh
anonymous:x:21:21::/nonexist:/usr/bin/nologin
avahi:x:84:84::/:/bin/false
bind:x:53:53::/:/usr/bin/nologin
daemon:x:2:2::/:/bin/sh
dbus:x:81:81::/:/usr/bin/nologin
dovecot:x:143:143::/dev/null:/usr/bin/nologin
ftp:x:21:21::/nonexist:/usr/bin/nologin
geohei:x:1026:100::/var/services/homes/geohei:/bin/sh
guest:x:1025:100:Guest:/nonexist:/usr/bin/nologin
http:x:1023:1023::/var/services/web:/bin/false
ldap:x:439:439::/var/lib/openldap:/usr/bin/nologin
lp:x:7:7::/var/spool/lpd:/bin/sh
mysql:x:66:66::/var/services/mysql:/bin/false
nobody:x:99:99::/:/bin/false
ntp:x:87:87::/var/lib/ntp:/bin/false
postfix:x:125:125::/dev/null:/usr/bin/nologin
postgres:x:55:55::/var/services/pgsql:/bin/sh
root:x:0:0::/root:/bin/ash
rpc:x:32:32::/dev/null:/bin/false
system:x:1:1::/usr/syno/synoman:/usr/bin/nologin

/var/services/homes/geohei is supposed to be geohei's home directory. However it was not created during initial DSM installation user setup, since not relevant for DSM. However while logging into the shell, it attempts to change to the directory (chdir), which doesn't exist, and complains. The present working directory (pwd) will therefore default to /.

/etc/passwd defines the user's home directory, which the shell is used (sh for user geohei), and much more.


Next ... sometimes, you might need root access. For instance, I cannot see the content of the file /etc/shadow as user geohei, since this file holds hashed passwords. I do need root access for this. The shell user right and permission management has nothing to do with the DSM user and permission management. User geohei might be administrator in DSM, but is only user in the shell.

geohei@neelix_vm:/$ cat /etc/shadow
cat: /etc/shadow: Permission denied
geohei@neelix_vm:/$ ls -l /etc/shadow
-rw------- 1 root root 902 Aug 15 16:03 /etc/shadow
geohei@neelix_vm:/$ sudo -i
Password:
root@neelix_vm:~# cat /etc/shadow
admin:$6$761Y.ISJWdMwjz2SdxGFghwFfgdEdztDWW34fvDFbcjGFhfNuiwebGZFTZvHFTZ5lhg7chgDDDhjkHKGjzmIFqfhxfelkRa163kR5/:17393:0:99999:7::1:
anonymous:*:10933:0:99999:7:::
avahi:*:10933:0:99999:7:::
bind:*:10933:0:99999:7:::
daemon:*:10933:0:99999:7:::
dbus:*:10933:0:99999:7:::
dovecot:*:10933:0:99999:7:::
ftp:*:10933:0:99999:7:::
geohei:$6$6ckppkOxsKj4MWy$8bjkdew./hbduzef5gve32rvj8/gdhwevd5/szu23e5mdtTFLuEDQl52zSA/.xAYgztw5RRdWcjF.tT.6OETc1:17393:0:99999:7:::
guest:$1$synergy$O31nVEghZgsd4Edrts8MK.:10933:0:99999:7::1:
http:*:10933:0:99999:7:::
ldap:*:10933:0:99999:7:::
lp:*:10933:0:99999:7:::
mysql:*:10933:0:99999:7:::
nobody:*:10933:0:99999:7:::
ntp:*:10933:0:99999:7:::
postfix:*:10933:0:99999:7:::
postgres:*:10933:0:99999:7:::
root:*:10933:0:99999:7:::
rpc:*:10933:0:99999:7:::
system:*:10933:0:99999:7:::

"sudo -i" gives root access to a non-root user. The password required is the password of the user, not the root password (which is not set as seen in /etc/shadow above).

/etc/shadow also shows that user admin, although disabled in DSM (default), has an (unknown) password stored.