{"id":6184,"date":"2021-10-20T13:36:04","date_gmt":"2021-10-20T13:36:04","guid":{"rendered":"https:\/\/www.geekdecoder.com\/?p=6184"},"modified":"2021-10-20T13:36:04","modified_gmt":"2021-10-20T13:36:04","slug":"installing-samba-on-ubuntu-21-04","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2021\/10\/20\/installing-samba-on-ubuntu-21-04\/","title":{"rendered":"Installing Samba on Ubuntu 21.04"},"content":{"rendered":"<p>To install Samba, we run:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsudo apt update\nsudo apt install samba\n<\/pre>\n<p>We can check if the installation was successful by running:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nwhereis samba\n<\/pre>\n<p>The following should be its output:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsamba: \/usr\/sbin\/samba \/usr\/lib\/x86_64-linux-gnu\/samba \/etc\/samba \/usr\/share\/samba \/usr\/share\/man\/man8\/samba.8.gz \/usr\/share\/man\/man7\/samba.7.gz\n<\/pre>\n<p>Setting up Samba<\/p>\n<p>Now that Samba is installed, we need to create a use and directory for it to share:<br \/>\nAdd a user<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# adduser roger\nAdding user `roger&#039; ...\nAdding new group `roger&#039; (1000) ...\nAdding new user `roger&#039; (1000) with group `roger&#039; ...\nCreating home directory `\/home\/roger&#039; ...\nCopying files from `\/etc\/skel&#039; ...\nNew password:\nRetype new password:\npasswd: password updated successfully\nChanging the user information for roger\nEnter the new value, or press ENTER for the default\n        Full Name &#x5B;]: Roger\n        Room Number &#x5B;]:\n        Work Phone &#x5B;]:\n        Home Phone &#x5B;]:\n        Other &#x5B;]:\nIs the information correct? &#x5B;Y\/n] y\n<\/pre>\n<p>Add a directory to share (replace your username here).<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nmkdir \/home\/roger\/sambashare\/\n<\/pre>\n<p>The command above creates a new folder sambashare in our home directory which we will share later.<\/p>\n<p>The configuration file for Samba is located at \/etc\/samba\/smb.conf. To add the new directory as a share, we edit the file. Lets backup first.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ncp \/etc\/samba\/smb.conf \/etc\/samba\/smb.conf-bk\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsudo nano \/etc\/samba\/smb.conf\n<\/pre>\n<p>Workgroup- make sure Workgroup is the same for your Windows box.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nworkgroup = WORKGROUP\n\n<\/pre>\n<p>At the bottom of the file, add the following lines:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n&#x5B;sambashare]\n    comment = Samba on Ubuntu\n    path = \/home\/username\/sambashare\n    read only = no\n    browsable = yes\n<\/pre>\n<p>Then press Ctrl-O to save and Ctrl-X to exit from the nano text editor.<br \/>\nWhat we\u2019ve just added<\/p>\n<p>    comment: A brief description of the share.<\/p>\n<p>    path: The directory of our share.<\/p>\n<p>    read only: Permission to modify the contents of the share folder is only granted when the value of this directive is no.<\/p>\n<p>    browsable: When set to yes, file managers such as Ubuntu\u2019s default file manager will list this share under \u201cNetwork\u201d (it could also appear as browseable).<\/p>\n<p>Now that we have our new share configured, save it and restart Samba for it to take effect:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsudo service smbd restart\n<\/pre>\n<p>Update the firewall rules to allow Samba traffic:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsudo ufw allow samba\n<\/pre>\n<p>Setting up User Accounts and Connecting to Share<\/p>\n<p>Since Samba doesn\u2019t use the system account password, we need to set up a Samba password for our user account:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsudo smbpasswd -a username\n<\/pre>\n<p>Note<br \/>\nUsername used must belong to a system account, else it won\u2019t save.<br \/>\nConnecting to Share<\/p>\n<p>On Ubuntu: Open up the default file manager and click Connect to Server then enter: <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsmb:\/\/ip-address\/sambashare\n<\/pre>\n<p>On Windows, open up File Manager and edit the file path to:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\\\\ip-address\\sambashare\n<\/pre>\n<p>Note: ip-address is the Samba server IP address and sambashare is the name of the share.<\/p>\n<p>You\u2019ll be prompted for your credentials. Enter them to connect! <\/p>\n<p>Excellent Article here: https:\/\/tecadmin.net\/mounting-samba-share-on-ubuntu\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To install Samba, we run: sudo apt update sudo apt install samba We can check if the installation was successful by running: whereis samba The following should be its output: samba: \/usr\/sbin\/samba \/usr\/lib\/x86_64-linux-gnu\/samba \/etc\/samba \/usr\/share\/samba \/usr\/share\/man\/man8\/samba.8.gz \/usr\/share\/man\/man7\/samba.7.gz Setting up Samba Now that Samba is installed, we need to create a use and directory for it &#8230; <a title=\"Installing Samba on Ubuntu 21.04\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2021\/10\/20\/installing-samba-on-ubuntu-21-04\/\" aria-label=\"Read more about Installing Samba on Ubuntu 21.04\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-6184","post","type-post","status-publish","format-standard","hentry","category-samba"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/6184","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=6184"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/6184\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=6184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=6184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=6184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}