{"id":179,"date":"2017-09-10T20:31:47","date_gmt":"2017-09-11T01:31:47","guid":{"rendered":"https:\/\/codemonkeyden.com\/blog\/?p=179"},"modified":"2023-11-10T23:05:04","modified_gmt":"2023-11-11T05:05:04","slug":"samba-file-server","status":"publish","type":"post","link":"https:\/\/codemonkeyden.com\/?p=179","title":{"rendered":"Host Your Own Samba File Server"},"content":{"rendered":"<h5>Motivation<\/h5>\n<p>A common problem with running a mixed-environment is sharing files between GNU\/Linux and Windows computers. The best way to provide Windows computers access to your GNU\/Linux file server is using Samba.<\/p>\n<h5>Prerequisites<\/h5>\n<p>Install samba server and client packages.<\/p>\n<pre>$ sudo apt-get install -y samba smbclient<\/pre>\n<h5>Configure Samba Server<\/h5>\n<p>I configure two shares: one read-only (called data) and one read-write (called data-rw). Append the following to the end of \/etc\/samba\/smb.conf:<\/p>\n<pre>[data]\n comment = Data Share (read-only)\n path = \/mnt\/md0\/\n available = yes\n valid users = myuser\n read only = yes\n browseable = yes\n public = yes\n writeable = no\n[data-rw]\n comment = Data Share\n path = \/mnt\/md0\/\n available = yes\n valid users = myuser\n read only = no\n browseable = yes\n public = yes\n writeable = yes<\/pre>\n<h5>Create Samba User<\/h5>\n<p>Next, create a new samba user using the following command and it will prompt you to specify a password for the user and then again to confirm the password.<\/p>\n<pre>sudo smbpasswd -a myuser\nNew SMB password:\nRetype new SMB password:<\/pre>\n<h5>Verify the Configuration with\u00a0testparm<\/h5>\n<p>The testparm utility checks the \/etc\/samba\/smb.conf configuration file for internal correctness.<\/p>\n<pre>$ testparm\nLoad smb config files from \/etc\/samba\/smb.conf\nrlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)\nWARNING: The \"syslog\" option is deprecated\nProcessing section \"[homes]\"\nProcessing section \"[printers]\"\nProcessing section \"[print$]\"\nProcessing section \"[data]\"\nProcessing section \"[data-rw]\"\nLoaded services file OK.\nServer role: ROLE_STANDALONE\n\nPress enter to see a dump of your service definitions<\/pre>\n<h5>Test the Samba Server with smbclient and smbget<\/h5>\n<p>smbclient can be used to verify\u00a0that all the shares are available on the\u00a0server.<\/p>\n<pre>$ smbclient -L euclid\nDomain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.5.8-Debian]\n\n Sharename   Type    Comment\n ---------   ----    -------\n print$      Disk    Printer Drivers\n data        Disk    Data Share (read-only)\n data-rw     Disk    Data Share\n IPC$        IPC     IPC Service (Samba 4.5.8-Debian)\n myuser      Disk    Home Directories\nDomain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.5.8-Debian]\n\n Server         Comment\n ---------      -------\n EUCLID         Samba 4.5.8-Debian\n\n Workgroup      Master\n ---------      -------\n WORKGROUP      EUCLID<\/pre>\n<p>smbget is a wget-like utility for downloading files from a samba share<\/p>\n<pre>$ smbget smb:\/\/euclid\/data\/test.txt\nUsing workgroup WORKGROUP, user myuser\nsmb:\/\/euclid\/data\/test.txt\nDownloaded 830b in 1 seconds<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Motivation A common problem with running a mixed-environment is sharing files between GNU\/Linux and Windows computers. The best way to provide Windows computers access to your GNU\/Linux file server is using Samba. Prerequisites Install samba server and client packages. $ sudo apt-get install -y samba smbclient Configure Samba Server I configure two shares: one read-only [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":417,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[5,10],"class_list":["post-179","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sysadmin","tag-debian","tag-samba"],"_links":{"self":[{"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=\/wp\/v2\/posts\/179","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=179"}],"version-history":[{"count":1,"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=\/wp\/v2\/posts\/179\/revisions"}],"predecessor-version":[{"id":502,"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=\/wp\/v2\/posts\/179\/revisions\/502"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=\/wp\/v2\/media\/417"}],"wp:attachment":[{"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}