{"id":447,"date":"2017-08-15T14:42:40","date_gmt":"2017-08-15T12:42:40","guid":{"rendered":"http:\/\/www.geohei.lu\/geoheiWP\/?p=447"},"modified":"2017-08-22T16:01:57","modified_gmt":"2017-08-22T14:01:57","slug":"synology-nas-console-basics","status":"publish","type":"post","link":"https:\/\/www.geohei.lu\/geoheiWP\/synology-nas-console-basics\/","title":{"rendered":"Synology NAS shell &#8211; Basics"},"content":{"rendered":"<p><code><a href=\"https:\/\/i0.wp.com\/www.geohei.lu\/geoheiWP\/wp-content\/uploads\/2017\/08\/synology_dsm.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.geohei.lu\/geoheiWP\/wp-content\/uploads\/2017\/08\/synology_dsm.png?resize=300%2C200\" alt=\"synology_dsm\" width=\"300\" height=\"200\" class=\"alignleft size-medium wp-image-459\" srcset=\"https:\/\/i0.wp.com\/www.geohei.lu\/geoheiWP\/wp-content\/uploads\/2017\/08\/synology_dsm.png?resize=300%2C200&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.geohei.lu\/geoheiWP\/wp-content\/uploads\/2017\/08\/synology_dsm.png?resize=768%2C512&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.geohei.lu\/geoheiWP\/wp-content\/uploads\/2017\/08\/synology_dsm.png?w=1008&amp;ssl=1 1008w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>The following article describes some basics regarding first contact with Synology DSM shell.<\/p>\n<p>I used DSM 6.1.3 out of the box, running in a Virtual machine (using <span class=\"highlight\" style=\"background-color: #404040;\">Virtual Machine Manager<\/span>) on DS1817+ hardware.<\/p>\n<p><!--more--><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>First, enable the SSH service DSM.<br \/>\n<span class=\"highlight\" style=\"background-color: #404040;\">Control Panel > Terminal & SNMP > Enable SSH service<\/span><br \/>\nTry not to use Telnet, not even locally (not secure).<br \/>\n<a href=\"http:\/\/www.putty.org\">PuTTY<\/a> is a good Windows SSH client.<\/p>\n<p>My test DSM server is called <span class=\"highlight\" style=\"background-color: #404040;\">neelix_vm<\/span>.<br \/>\nMy test user is called <span class=\"highlight\" style=\"background-color: #404040;\">geohei<\/span>.<\/p>\n<p>Login using the name and password of the user created during the initial DSM installation process.<\/p>\n<pre>login as: geohei\r\ngeohei@192.168.1.162's password:\r\nCould not chdir to home directory \/var\/services\/homes\/geohei: No such file or directory\r\ngeohei@neelix_vm:\/$ ls -l \/var\/services\/\r\ntotal 0\r\nlrwxrwxrwx 1 root root 24 Aug 15 13:41 pgsql -> \/volume1\/@database\/pgsql\r\nlrwxrwxrwx 1 root root 13 Aug 15 13:42 tmp -> \/volume1\/@tmp\r\ngeohei@neelix_vm:\/$ pwd\r\n\/\r\ngeohei@neelix_vm:\/$ cat \/etc\/passwd\r\nadmin:x:1024:100:System default user:\/var\/services\/homes\/admin:\/bin\/sh\r\nanonymous:x:21:21::\/nonexist:\/usr\/bin\/nologin\r\navahi:x:84:84::\/:\/bin\/false\r\nbind:x:53:53::\/:\/usr\/bin\/nologin\r\ndaemon:x:2:2::\/:\/bin\/sh\r\ndbus:x:81:81::\/:\/usr\/bin\/nologin\r\ndovecot:x:143:143::\/dev\/null:\/usr\/bin\/nologin\r\nftp:x:21:21::\/nonexist:\/usr\/bin\/nologin\r\ngeohei:x:1026:100::\/var\/services\/homes\/geohei:\/bin\/sh\r\nguest:x:1025:100:Guest:\/nonexist:\/usr\/bin\/nologin\r\nhttp:x:1023:1023::\/var\/services\/web:\/bin\/false\r\nldap:x:439:439::\/var\/lib\/openldap:\/usr\/bin\/nologin\r\nlp:x:7:7::\/var\/spool\/lpd:\/bin\/sh\r\nmysql:x:66:66::\/var\/services\/mysql:\/bin\/false\r\nnobody:x:99:99::\/:\/bin\/false\r\nntp:x:87:87::\/var\/lib\/ntp:\/bin\/false\r\npostfix:x:125:125::\/dev\/null:\/usr\/bin\/nologin\r\npostgres:x:55:55::\/var\/services\/pgsql:\/bin\/sh\r\nroot:x:0:0::\/root:\/bin\/ash\r\nrpc:x:32:32::\/dev\/null:\/bin\/false\r\nsystem:x:1:1::\/usr\/syno\/synoman:\/usr\/bin\/nologin<\/pre>\n<\/p>\n<p><span class=\"highlight\" style=\"background-color: #404040;\">\/var\/services\/homes\/geohei<\/span> 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 <span class=\"highlight\" style=\"background-color: #404040;\">\/<\/span>.<\/p>\n<p><span class=\"highlight\" style=\"background-color: #404040;\">\/etc\/passwd<\/span> defines the user's home directory, which the shell is used (sh for user geohei), and much more.<\/p>\n<hr \/>\n<p>Next ... sometimes, you might need root access. For instance, I cannot see the content of the file <span class=\"highlight\" style=\"background-color: #404040;\">\/etc\/shadow<\/span> 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.<\/p>\n<pre>geohei@neelix_vm:\/$ cat \/etc\/shadow\r\ncat: \/etc\/shadow: Permission denied\r\ngeohei@neelix_vm:\/$ ls -l \/etc\/shadow\r\n-rw------- 1 root root 902 Aug 15 16:03 \/etc\/shadow\r\ngeohei@neelix_vm:\/$ sudo -i\r\nPassword:\r\nroot@neelix_vm:~# cat \/etc\/shadow\r\nadmin:$6$761Y.ISJWdMwjz2SdxGFghwFfgdEdztDWW34fvDFbcjGFhfNuiwebGZFTZvHFTZ5lhg7chgDDDhjkHKGjzmIFqfhxfelkRa163kR5\/:17393:0:99999:7::1:\r\nanonymous:*:10933:0:99999:7:::\r\navahi:*:10933:0:99999:7:::\r\nbind:*:10933:0:99999:7:::\r\ndaemon:*:10933:0:99999:7:::\r\ndbus:*:10933:0:99999:7:::\r\ndovecot:*:10933:0:99999:7:::\r\nftp:*:10933:0:99999:7:::\r\ngeohei:$6$6ckppkOxsKj4MWy$8bjkdew.\/hbduzef5gve32rvj8\/gdhwevd5\/szu23e5mdtTFLuEDQl52zSA\/.xAYgztw5RRdWcjF.tT.6OETc1:17393:0:99999:7:::\r\nguest:$1$synergy$O31nVEghZgsd4Edrts8MK.:10933:0:99999:7::1:\r\nhttp:*:10933:0:99999:7:::\r\nldap:*:10933:0:99999:7:::\r\nlp:*:10933:0:99999:7:::\r\nmysql:*:10933:0:99999:7:::\r\nnobody:*:10933:0:99999:7:::\r\nntp:*:10933:0:99999:7:::\r\npostfix:*:10933:0:99999:7:::\r\npostgres:*:10933:0:99999:7:::\r\nroot:*:10933:0:99999:7:::\r\nrpc:*:10933:0:99999:7:::\r\nsystem:*:10933:0:99999:7:::<\/pre>\n<\/p>\n<p>\"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 <span class=\"highlight\" style=\"background-color: #404040;\">\/etc\/shadow<\/span> above).<\/p>\n<p><span class=\"highlight\" style=\"background-color: #404040;\">\/etc\/shadow<\/span> also shows that user admin, although disabled in DSM (default), has an (unknown) password stored.<\/p>\n<p><code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The 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&#8230;. <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/www.geohei.lu\/geoheiWP\/synology-nas-console-basics\/\">Read More<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[31],"tags":[],"class_list":["post-447","post","type-post","status-publish","format-standard","hentry","category-synology"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5mjlH-7d","_links":{"self":[{"href":"https:\/\/www.geohei.lu\/geoheiWP\/wp-json\/wp\/v2\/posts\/447","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.geohei.lu\/geoheiWP\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.geohei.lu\/geoheiWP\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.geohei.lu\/geoheiWP\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.geohei.lu\/geoheiWP\/wp-json\/wp\/v2\/comments?post=447"}],"version-history":[{"count":18,"href":"https:\/\/www.geohei.lu\/geoheiWP\/wp-json\/wp\/v2\/posts\/447\/revisions"}],"predecessor-version":[{"id":467,"href":"https:\/\/www.geohei.lu\/geoheiWP\/wp-json\/wp\/v2\/posts\/447\/revisions\/467"}],"wp:attachment":[{"href":"https:\/\/www.geohei.lu\/geoheiWP\/wp-json\/wp\/v2\/media?parent=447"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.geohei.lu\/geoheiWP\/wp-json\/wp\/v2\/categories?post=447"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.geohei.lu\/geoheiWP\/wp-json\/wp\/v2\/tags?post=447"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}