{"id":15,"date":"2019-11-01T01:03:03","date_gmt":"2019-11-01T01:03:03","guid":{"rendered":"https:\/\/www.grizzly-hills.com\/?p=15"},"modified":"2019-11-01T01:03:03","modified_gmt":"2019-11-01T01:03:03","slug":"ubuntu-19-10-installing-samba","status":"publish","type":"post","link":"https:\/\/www.grizzly-hills.com\/index.php\/2019\/11\/01\/ubuntu-19-10-installing-samba\/","title":{"rendered":"Ubuntu 19.10: File Sharing to Windows and Mac"},"content":{"rendered":"\n<p>Setting up Samba under Ubuntu 19.10 is relatively easy. This guide will show how to install Samba itself, then configure both a public drive meant to be shared among multiple users, and a per-user drive.<\/p>\n\n\n<p><em><strong>NOTE<\/strong>: This guide assumes your linux machine is on your local network.<\/em><\/p>\n\n\n<p>First, install both samba and smbclient:<\/p>\n\n\n<pre class=\"wp-block-preformatted\"><strong>sudo apt install samba smbclient<\/strong><\/pre>\n\n\n<p>Next, create a directory that will be the shared public drive, and set its ownership:<\/p>\n\n\n<pre class=\"wp-block-preformatted\"><strong>sudo mkdir -p \/srv\/samba\/public\nsudo chown nobody:nogroup \/srv\/samba\/public\nsudo chmod 777 \/srv\/samba\/public<\/strong><\/pre>\n\n\n<p>Now it&#8217;s time to configure Samba. There&#8217;s two basic things that need to be configured: setting the user security, and adding the public drive.<\/p>\n\n\n<p> To set the user security,  set <code><strong>security = user<\/strong><\/code> in the <code><strong>[global]<\/strong><\/code> section of <code><strong>\/etc\/samba\/smb.conf<\/strong><\/code>.<\/p>\n\n\n<p>Enable the per-user drive in <code><strong>\/etc\/samba\/smb.conf<\/strong><\/code>:<\/p>\n\n\n<pre class=\"wp-block-preformatted\"><strong>[homes]\n    comment = Home Directories\n    browseable = no<\/strong>\n<strong>    read only = no<\/strong><\/pre>\n\n\n<p>To add the public drive, add this section to the end of <code><strong>\/etc\/samba\/smb.conf<\/strong><\/code>:<\/p>\n\n\n<pre class=\"wp-block-preformatted\"><strong>[public]\n   comment = Public Files\n   path = \/srv\/samba\/public\n   browsable = yes\n   guest ok = yes\n   read only = no\n   create mask = 0755<\/strong><\/pre>\n\n\n<p>Now, restart the Samba services to pick up these configuration changes:<\/p>\n\n\n<pre class=\"wp-block-preformatted\"><strong>sudo systemctl restart smbd.service nmbd.service<\/strong><\/pre>\n\n\n<p>Since Samba doesn&#8217;t use the linux login credentials for a user, you must add each user that needs access to a shared drive using the  <code><strong>smbpasswd<\/strong><\/code> command:<\/p>\n\n\n<pre class=\"wp-block-preformatted\"><strong>sudo smbpasswd -a &lt;unix username&gt;<\/strong><\/pre>\n\n\n<p>Also, if you&#8217;re running a firewall on your linux machine, you&#8217;ll probably have to allow access for your local network. You can allow specific machines, or a subnet. I use ufw to control my firewall configuration, so for me I simply allowed all access for my internal network:<\/p>\n\n\n<pre class=\"wp-block-preformatted\"><strong>sudo ufw allow from 192.168.0.0\/16<\/strong><\/pre>\n\n\n<p>To connect to a drive from Windows, I right-click on the <code><strong>Network <\/strong><\/code>item in <code><strong>File Explorer<\/strong><\/code> and select <code><strong>Map network drive...<\/strong><\/code>, and use <code><strong>\\\\&lt;hostname&gt;\\public<\/strong><\/code> or <code><strong>\\\\&lt;hostname&gt;\\&lt;unix username&gt;<\/strong><\/code> as the Folder.<\/p>\n\n\n<p>To connect to a drive from the Mac, I use <code><strong>Go -&gt; Connect to Server...<\/strong><\/code> in the Finder, then use <code><strong>smb:\/\/&lt;hostname&gt;\/public<\/strong><\/code> or <code><strong>smb:\/\/&lt;hostname&gt;\/&lt;unix username&gt;<\/strong><\/code> as the address.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting up Samba under Ubuntu 19.10 is relatively easy. This guide will show how to install Samba itself, then configure both a public drive meant to be shared among multiple users, and a per-user drive. NOTE: This guide assumes your linux machine is on your local network. First, install both samba and smbclient: sudo apt &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.grizzly-hills.com\/index.php\/2019\/11\/01\/ubuntu-19-10-installing-samba\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Ubuntu 19.10: File Sharing to Windows and Mac&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[16,21],"class_list":["post-15","post","type-post","status-publish","format-standard","hentry","category-linux-systems-administration","tag-linux","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/www.grizzly-hills.com\/index.php\/wp-json\/wp\/v2\/posts\/15","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.grizzly-hills.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.grizzly-hills.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.grizzly-hills.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.grizzly-hills.com\/index.php\/wp-json\/wp\/v2\/comments?post=15"}],"version-history":[{"count":0,"href":"https:\/\/www.grizzly-hills.com\/index.php\/wp-json\/wp\/v2\/posts\/15\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.grizzly-hills.com\/index.php\/wp-json\/wp\/v2\/media?parent=15"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.grizzly-hills.com\/index.php\/wp-json\/wp\/v2\/categories?post=15"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.grizzly-hills.com\/index.php\/wp-json\/wp\/v2\/tags?post=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}