Crmgo Blog

Quick Installation of Samba

Quick Installation of Samba

To install "Samba" on CentOS, we'll use our trusty old friend "yum": yum install -y samba. The -y flag pre-confirms all prompts so you don't have to type "yes" multiple times. After downloading approximately 24 megabytes and a brief installation process, we proceed with the configuration.…

Quick Installation of Samba

To install "Samba" on CentOS, we will use our old and reliable "yum":

yum install -y samba

-y automatically confirms all prompts in advance, so you don't have to type "yes" multiple times

After downloading approximately 24 megabytes and a brief installation process, we proceed to configuration.

First, let's create the folders that we will share (if you do not want to grant access to folders that already exist in the system).

mkdir -m 777 /home/incoming

creates the folder /incoming in the /home directory and grants full read, write, and execute permissions to all users

mkdir -m 777 /home/read

Creates the folder /read in the same directory with the same permissions as the previously created folder (you can, of course, set different permissions depending on your server's security policy; here we are considering the simplest setup of an anonymous SAMBA server)

Next, we go to configure the Samba configuration file /etc/samba/smb.conf
By default, it already contains a preliminary configuration with many comments and settings. You could certainly edit it and, after reading some literature, create your own super smart and impenetrable configuration, but as I mentioned above, we are running the simplest configuration, so we overwrite our file with the command:

>/etc/samba/smb.conf

Then, we enter the following into our empty configuration file:


[global]

workgroup = workgroup
netbios name = CentOS
server string = MyServer
security = share
browseable = Yes

[incoming]

path = /home/incoming
readonly = No
guest ok = Yes

[read]

path = /home/read
readonly = Yes
guest ok = Yes


Anyone with at least a basic knowledge of English will find it easy to understand the meaning of this configuration:

[global] - this block describes the global settings of our server
workgroup = "name of the workgroup in your network"

netbios name = "name of your computer, which will be displayed in 'Network Neighborhood'"
server string = "description of your computer; any sentence is acceptable (including Russian)"
security = "security level of your Samba server" (in this case, share)
browseable = "visibility of the resource on the network" (if set to NO, you can only access the provided resource by specifying the explicit path to the shared folder in the address bar)
[incoming] - "name of our folder on the network, as well as the block of settings for this folder"

path = "full system path to the folder we are sharing"

readonly = "write permissions", NO - you can write to this folder, Yes - the folder is available to users in read-only mode (thus, the incoming folder is set to "full access", while the read folder is read-only)

[read] - "the name of our folder in the network, as well as the block of settings for this folder"

So, the configuration file has been successfully filled out - we save and close it.

Let's check, just in case, that we haven't made any syntax errors in our file, using the testparm command:

testparm /etc/samba/smb.conf

If everything is fine, we start our server:

service smb start

Everything should start successfully.

We add our smb service to the "autostart":

chkconfig --level 2345 smb on

or we set a "star" next to smb in the "system services" menu, using the SETUP command.

This completes the simple procedure of starting SAMBA.
We check in the browser of any free computer on the network, our newly opened resources, and remember the author of the article with good words ;-) .

Note: This post may be AI-assisted and then human-edited. Editorial responsibility: Dmytro Lomaka, Kaltenkirchen.