{"id":20790,"date":"2023-08-31T18:34:52","date_gmt":"2023-08-31T18:34:52","guid":{"rendered":"https:\/\/linuxways.net\/?p=20790"},"modified":"2023-08-31T18:34:52","modified_gmt":"2023-08-31T18:34:52","slug":"how-to-install-samba-in-debian-bookworm","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/debian\/how-to-install-samba-in-debian-bookworm\/","title":{"rendered":"How to Install Samba in Debian Bookworm"},"content":{"rendered":"<p><strong>Debian Bookworm<\/strong>, also known as the universal operating system, is used to develop software, edit documents, route emails, etc. We can use Debian to install Samba and enhance many features such as file sharing, browsing, authentication, authorization, etc.<\/p>\n<p>The complete procedure for installing samba in Debian bookworm is described in this write-up.<\/p>\n<h2><strong>What is Samba?<\/strong><\/h2>\n<p>According to the official documentation of Samba, it is a Linux tool used to share directories from Linux servers to different operating systems. The two main protocols like Server Message Block (SMB) and Common Internet File System (CIFS) protocols are used by Samba. Samba offers flexibility with respect to setup, configuration, etc.<\/p>\n<h2><strong>How to Install Samba in Debian Bookworm?<\/strong><\/h2>\n<p>Installing samba in Debian Bookworm is a straightforward process. Open up the Debian terminal and execute the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> samba<\/div><\/div>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"778\" height=\"285\" class=\"wp-image-20791\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-1.png 778w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-1-300x110.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-1-768x281.png 768w\" sizes=\"auto, (max-width: 778px) 100vw, 778px\" \/><\/strong><\/p>\n<p>As we can see Debian is asking for permission because installing Samba in Debian is going to take an additional 92.0 MB of space. Click on \u201c<strong>Y<\/strong>\u201d to continue the installation process as shown below:<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"641\" height=\"45\" class=\"wp-image-20792\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-2.png 641w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-2-300x21.png 300w\" sizes=\"auto, (max-width: 641px) 100vw, 641px\" \/><\/strong><\/p>\n<p>Debian is downloading the Samba package for us as shown in the screenshot below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"766\" height=\"430\" class=\"wp-image-20794\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-3.png 766w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-3-300x168.png 300w\" sizes=\"auto, (max-width: 766px) 100vw, 766px\" \/><\/p>\n<p>After a few minutes, samba would be installed successfully as indicated below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"451\" class=\"wp-image-20797\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-4.png 786w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-4-300x172.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-4-768x441.png 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/p>\n<p>To confirm the installation, execute the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span>systemctl status smbd<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"789\" height=\"453\" class=\"wp-image-20799\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-5.png 789w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-5-300x172.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-5-768x441.png 768w\" sizes=\"auto, (max-width: 789px) 100vw, 789px\" \/><\/p>\n<p>Hence we can see that Samba is running successfully as shown in the snapshot below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"788\" height=\"448\" class=\"wp-image-20800\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-6.png 788w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-6-300x171.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-6-768x437.png 768w\" sizes=\"auto, (max-width: 788px) 100vw, 788px\" \/><\/p>\n<h2><strong>How to Configure Samba in Debian Bookworm?<\/strong><\/h2>\n<p>Samba configuration settings can be displayed by executing the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">sudo<\/span> nano<span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>samba<span class=\"sy0\">\/<\/span>smb.conf<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"471\" height=\"59\" class=\"wp-image-20801\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-7.png 471w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-7-300x38.png 300w\" sizes=\"auto, (max-width: 471px) 100vw, 471px\" \/><\/p>\n<p>After the command has been executed successfully, the file will look like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"777\" height=\"476\" class=\"wp-image-20803\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-8.png 777w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-8-300x184.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-8-768x470.png 768w\" sizes=\"auto, (max-width: 777px) 100vw, 777px\" \/><\/p>\n<p>The above screenshot shows some basic settings like <strong>workgroup <\/strong>and<strong> interfaces<\/strong>.<\/p>\n<p>workgroup describes the Operating System we are connected to. If we want to connect with different groups we can change it accordingly. Interfaces demonstrate which IP addresses are connected to our Samba network. Hence, these settings tell us that Samba is secure and only the user can allow which devices are to be connected with Samba.<\/p>\n<p>To generate our user, we first need to enter a name. You can choose your own name. We are going with \u201c<strong>my new share<\/strong>\u201d.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">Comment = my new share<\/div><\/div>\n<p>Now set the path as shown below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">path = <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>user<span class=\"sy0\">\/<\/span>share<\/div><\/div>\n<p>Set the browseable to yes in order to browse it with the share as seen below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">browseable = <span class=\"kw2\">yes<\/span><\/div><\/div>\n<p>Now we can set the things either to be readable only or to be editable too as follows:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">read<\/span> only = no<\/div><\/div>\n<p>We can either set a password in order to avoid any anonymous user or we simply cannot provide a password as listed below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">Guest ok = no<\/div><\/div>\n<p>Now allow the valid user who can access it. In our case, it\u2019s Ahsaan as shown below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">Valid <span class=\"kw2\">users<\/span> = Ahsaan<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"773\" height=\"361\" class=\"wp-image-20805\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-9.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-9.png 773w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-9-300x140.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-9-768x359.png 768w\" sizes=\"auto, (max-width: 773px) 100vw, 773px\" \/><\/p>\n<p>To save the configuration file press \u201c<strong>CTRL + S<\/strong>\u201d, then press \u201c<strong>CTRL + X<\/strong>\u201d, type \u201c<strong>Y<\/strong>\u201d and press \u201c<strong>ENTER<\/strong>\u201d. Now we have to follow a few steps to complete our configuration as listed below:<\/p>\n<h2><strong>How to Restart Samba?<\/strong><\/h2>\n<p>Now restart Samba with the help of the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">sudo<\/span> systemctl restart smbd<\/div><\/div>\n<h2><strong>How to Verify Samba Configuration?<\/strong><\/h2>\n<p>Run the command shown below, to verify the samba configuration:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">sudo<\/span> testparm<\/div><\/div>\n<p>The result looks something like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"777\" height=\"459\" class=\"wp-image-20806\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-10.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-10.png 777w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-10-300x177.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-10-768x454.png 768w\" sizes=\"auto, (max-width: 777px) 100vw, 777px\" \/><\/p>\n<p>The above snippet shows that everything is working perfectly fine.<\/p>\n<h2><strong>How to Set Up a Samba User?<\/strong><\/h2>\n<p>We need to set up a Samba user in order to connect with our \u201c<strong>new share<\/strong>\u201d.The command for setting up a new user is given below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span>smbpasswd <span class=\"re5\">-a<\/span> Ahsaan<\/div><\/div>\n<p>You can use any name of your choice instead of \u201cAhsaan\u201d.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"758\" height=\"506\" class=\"wp-image-20807\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-11.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-11.png 758w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-11-300x200.png 300w\" sizes=\"auto, (max-width: 758px) 100vw, 758px\" \/><\/p>\n<h2><strong>How to Connect With Share?<\/strong><\/h2>\n<p>To connect with a share, we need to install some packages. Use the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> samba-client cifs-utils<\/div><\/div>\n<p>The above command returns the following output as shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"688\" height=\"344\" class=\"wp-image-20808\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-12.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-12.png 688w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-12-300x150.png 300w\" sizes=\"auto, (max-width: 688px) 100vw, 688px\" \/><\/p>\n<p>Debian asks for permission because an extra 2513 kB of disk space is required. Press \u201c<strong>Y<\/strong>\u201d to continue.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"789\" height=\"385\" class=\"wp-image-20810\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-13.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-13.png 789w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-13-300x146.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-13-768x375.png 768w\" sizes=\"auto, (max-width: 789px) 100vw, 789px\" \/><\/p>\n<p>After pressing \u201c<strong>Y<\/strong>\u201d, it may take a few minutes depending upon your PC and internet connection and the required packages will be installed successfully.<\/p>\n<p>Now to open our Debian files, we will go to our Debian PC, and click on the \u201c<strong>Files<\/strong>\u201d icon as shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"631\" height=\"487\" class=\"wp-image-20812\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-14.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-14.png 631w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-14-300x232.png 300w\" sizes=\"auto, (max-width: 631px) 100vw, 631px\" \/><\/p>\n<p>In the snapshot below we can see the \u201c<strong>Other Locations<\/strong>\u201d option. Click on it:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"505\" class=\"wp-image-20813\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-15.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-15.png 786w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-15-300x193.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-15-768x493.png 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/p>\n<p>Now navigate to the \u201c<strong>Networks<\/strong>\u201d and select \u201c<strong>Debian<\/strong>\u201d as shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"792\" height=\"519\" class=\"wp-image-20814\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-16.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-16.png 792w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-16-300x197.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-16-768x503.png 768w\" sizes=\"auto, (max-width: 792px) 100vw, 792px\" \/><\/p>\n<p>We can see the \u201c<strong>new_share<\/strong>\u201d folder.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"797\" height=\"513\" class=\"wp-image-20815\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-17.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-17.png 797w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-17-300x193.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-17-768x494.png 768w\" sizes=\"auto, (max-width: 797px) 100vw, 797px\" \/><\/p>\n<p>Thus, now we can grant permission for file access from any Linux\/Debian Machine to a new user if the user is a member of a similar LAN.<\/p>\n<h2><strong>How to Uninstall Samba in Debian<\/strong><\/h2>\n<p>To uninstall Samba in Debian Bookworm, simply execute the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">sudo<\/span> apt remove samba<\/div><\/div>\n<p>After executing this command, Samba would be uninstalled from Debian successfully.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"740\" height=\"321\" class=\"wp-image-20819\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-18.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-18.png 740w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20790-18-300x130.png 300w\" sizes=\"auto, (max-width: 740px) 100vw, 740px\" \/><\/p>\n<p>The terminal asks for permission. Pressing \u201cY\u201d will confirm the uninstallation of Samba from your system.<\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>To install samba in Debian Bookworm, simply open the Debian terminal and execute the \u201c<strong>sudo apt install samba<\/strong>\u201d command. To confirm the installation, execute the \u201c<strong>systemctl status smbd<\/strong>\u201d command. Furthermore, we can configure samba in Debian bookworm using \u201c<strong>sudo nano\/etc\/samba\/smb.conf<\/strong>\u201d. Then to verify the configuration setup use the \u201c<strong>sudo testparm<\/strong>\u201d command. To connect with a share, we can use the \u201c<strong>sudo apt install samba-client cifs-utils<\/strong>\u201d command. This article has illustrated how to install and configure Samba in Debian Bookworm.<\/p>","protected":false},"excerpt":{"rendered":"<p>To install Samba in Debian Bookworm, execute the \u201csudo apt install samba\u201d command. To confirm the installation, execute the \u201csystemctl status smbd\u201d command.<\/p>","protected":false},"author":110,"featured_media":20809,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-20790","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/20790","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=20790"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/20790\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/20809"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=20790"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=20790"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=20790"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}