
{"id":4936,"date":"2024-02-23T11:28:51","date_gmt":"2024-02-23T16:28:51","guid":{"rendered":"https:\/\/ikriv.com\/blog\/?p=4936"},"modified":"2024-02-23T11:28:51","modified_gmt":"2024-02-23T16:28:51","slug":"ubuntu-uid-gid-option-required-to-gain-write-access-to-remote-share","status":"publish","type":"post","link":"https:\/\/ikriv.com\/blog\/?p=4936","title":{"rendered":"Ubuntu: uid\/gid option required to gain write access to remote share"},"content":{"rendered":"<p>I have Synology NAS, and I share the &#8220;home&#8221; directory as a CIFS share.<\/p>\n<p>From Windows, I simply do <code>net use N: \\\\home\\nas \/user:myuser *<\/code>, and it works.<\/p>\n<p>Corresponding command from Ubuntu is<\/p>\n<p><code>sudo mount -t cifs \/\/nas\/home \/mnt\/nas -o username=myuser<\/code><\/p>\n<p>It works, but the mount is effectively read-only: I am unable to make any modification to remote files or create new files\/directories. The effect is the same even if I add &#8220;rw&#8221; option.<\/p>\n<p>I used ChatGPT to ask what to do in this case, and it advised to add &#8220;uid&#8221; and &#8220;gid&#8221; parameters. Apparently, remote files are considered to be owned by &#8216;root&#8217;, and my users is not allowed to make changes. The following command works:<\/p>\n<p><code>sudo mount -t cifs \/\/nas\/home \/mnt\/nas -o username=ikriv,rw,uid=1000,gid=1000<\/code><\/p>\n<p>Here &#8220;1000&#8221; is ID of the user root. I suppose &#8220;rw&#8221; is redundant, but it does not harm.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have Synology NAS, and I share the &#8220;home&#8221; directory as a CIFS share. From Windows, I simply do net use N: \\\\home\\nas \/user:myuser *, and it works. Corresponding command <a href=\"https:\/\/ikriv.com\/blog\/?p=4936\" class=\"more-link\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"Layout":"","footnotes":""},"categories":[4],"tags":[],"class_list":["entry","author-ikriv","post-4936","post","type-post","status-publish","format-standard","category-hack"],"_links":{"self":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4936","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4936"}],"version-history":[{"count":1,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4936\/revisions"}],"predecessor-version":[{"id":4937,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4936\/revisions\/4937"}],"wp:attachment":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}