{"id":894,"date":"2019-06-23T10:02:08","date_gmt":"2019-06-23T10:02:08","guid":{"rendered":"https:\/\/www.web-workers.ch\/?p=894"},"modified":"2021-12-04T12:00:59","modified_gmt":"2021-12-04T11:00:59","slug":"how-to-install-configure-samba-basics-on-centos7","status":"publish","type":"post","link":"https:\/\/www.web-workers.ch\/index.php\/2019\/06\/23\/how-to-install-configure-samba-basics-on-centos7\/","title":{"rendered":"How to install\/configure Samba basics on CentOS7"},"content":{"rendered":"<h3>Install Samba<\/h3>\n<p><code># yum -y install samba*<\/code><\/p>\n<h3>Enable Samba<\/h3>\n<p><code># systemctl start smb<\/p>\n<h1>systemctl enable smb<\/code><\/h1>\n<h3>Sample configuration<\/h3>\n<p>The sample configuration below can be used to get access to your linux root folder via &#92;ip-address\\root$ with the user root.<\/p>\n<p><code># cat \/etc\/samba\/smb.conf<br \/>\n<\/code><code><\/p>\n<h1>See smb.conf.example for a more detailed config file or<\/h1>\n<h1>read the smb.conf manpage.<\/h1>\n<h1>Run 'testparm' to verify the config is correct after<\/h1>\n<h1>you modified it.<\/h1>\n<p><\/code><code><br \/>\n[global]<br \/>\nworkgroup = SAMBA<br \/>\nsecurity = user<br \/>\npassdb backend = tdbsam<br \/>\nprinting = cups<br \/>\nprintcap name = cups<br \/>\nload printers = yes<br \/>\ncups options = raw<br \/>\n<\/code><code><br \/>\n[homes]<br \/>\ncomment = Home Directories<br \/>\nvalid users = %S, %D%w%S<br \/>\nbrowseable = No<br \/>\nread only = No<br \/>\ninherit acls = Yes<br \/>\n<\/code><code><br \/>\n[printers]<br \/>\ncomment = All Printers<br \/>\npath = \/var\/tmp<br \/>\nprintable = Yes<br \/>\ncreate mask = 0600<br \/>\nbrowseable = No<br \/>\n<\/code><code><br \/>\n[print$]<br \/>\ncomment = Printer Drivers<br \/>\npath = \/var\/lib\/samba\/drivers<br \/>\nwrite list = root<br \/>\ncreate mask = 0664<br \/>\ndirectory mask = 0775<br \/>\n<\/code><code><br \/>\n[root$]<br \/>\nforce user = root<br \/>\ncreate mask = 0755<br \/>\nwriteable = yes<br \/>\nbrowsable = yes<br \/>\npath = \/<br \/>\n<\/code><\/p>\n<h3>Manage Samba users<\/h3>\n<p>In this example a new Linux user called &#8216;admin&#8217; will be created\/modified\/removed and this user will be added to the samba configuration.<\/p>\n<h5>Add users<\/h5>\n<p><code># useradd admin<\/p>\n<h1>passwd admin<\/h1>\n<h1>smbpasswd -a admin<\/code><\/h1>\n<p>Modify users<\/p>\n<p><code># passwd admin<\/p>\n<h1>smbpasswd admin<\/code><\/h1>\n<h5>Remove users<\/h5>\n<p><code># smbpasswd -x admin<\/p>\n<h1>userdel -r admin<\/code><\/h1>\n<h3>Allowing user to access samba share<\/h3>\n<p>Configure the Samba share in the \/etc\/samba\/smb.conf configuration file to allow the new user to browse the share:<\/p>\n<p><code># vi \/etc\/samba\/smb.conf<br \/>\n[share1]<br \/>\ncomment = A Shared Directory<br \/>\npath = \/var\/tmp\/sharedir<br \/>\nvalid users = <strong>admin<\/strong><br \/>\npublic = no<br \/>\nwritable = yes<\/code><\/p>\n<p>Reload the smb.conf configuration file with below command.<\/p>\n<p><code># systemctl reload smb<\/code><\/p>\n<h3>Mount driveletter from windows<\/h3>\n<p>To mount the example above, use this command on Windows cmd.exe-terminal:<\/p>\n<p><code>net use L: \\\\ip-address\\root$ \/user:root your_password<\/code><\/p>\n<h3>Troubleshooting<\/h3>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1511\" data-permalink=\"https:\/\/www.web-workers.ch\/index.php\/2019\/06\/23\/how-to-install-configure-samba-basics-on-centos7\/share\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.web-workers.ch\/wp-content\/uploads\/2019\/06\/share.jpg?fit=520%2C164&amp;ssl=1\" data-orig-size=\"520,164\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"share\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.web-workers.ch\/wp-content\/uploads\/2019\/06\/share.jpg?fit=300%2C95&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.web-workers.ch\/wp-content\/uploads\/2019\/06\/share.jpg?fit=520%2C164&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.web-workers.ch\/wp-content\/uploads\/2019\/06\/share.jpg?resize=300%2C95&#038;ssl=1\" alt=\"\" width=\"300\" height=\"95\" class=\"alignnone size-medium wp-image-1511\" srcset=\"https:\/\/i0.wp.com\/www.web-workers.ch\/wp-content\/uploads\/2019\/06\/share.jpg?resize=300%2C95&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.web-workers.ch\/wp-content\/uploads\/2019\/06\/share.jpg?w=520&amp;ssl=1 520w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Looking at the message log file at \/var\/log\/messages showed the following:<\/p>\n<p><code># tail -f \/var\/log\/samba\/log.smbd<\/p>\n<h1>smbd: make_connection_snum: canonicalize_connect_path failed for service share, path \/PATH TO SHARE\/share<\/code><\/h1>\n<p>In case you see this error message, while you try to connect to your share, then verify following settings.<\/p>\n<h5>Make sure the folder has the execute bit enabled<\/h5>\n<p><code># chmod -R a+x \/PATH TO SHARE\/<\/code><\/p>\n<h5>Make sure smbv2 is enabled<\/h5>\n<p><code># vi \/etc\/samba\/smb.conf<br \/>\n[Global]<br \/>\nmin protocol = SMB2<\/p>\n<h1>systemctl restart smb<\/code><\/h1>\n<h5>Make sure SELinux is disabled<\/h5>\n<p><code># vi \/etc\/selinux\/config<br \/>\nSELINUX=disabled<\/p>\n<h1>reboot<\/code><\/h1>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install Samba # yum -y install samba* Enable Samba # systemctl start smb systemctl enable smb Sample configuration The sample configuration below can be used to get access to your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":897,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_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}},"categories":[4],"tags":[34,10,121],"class_list":["post-894","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-centos","tag-linux","tag-samba"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.web-workers.ch\/wp-content\/uploads\/2019\/06\/samba-12001.png?fit=1200%2C627&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8sxjX-eq","jetpack-related-posts":[],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/posts\/894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/comments?post=894"}],"version-history":[{"count":15,"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/posts\/894\/revisions"}],"predecessor-version":[{"id":1512,"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/posts\/894\/revisions\/1512"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/media\/897"}],"wp:attachment":[{"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/media?parent=894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/categories?post=894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/tags?post=894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}