Monday, 27 November 2017

Configuring Samba server in Red Hat Enterprise Linux 7

CONFIGURING A SAMBA SERVER

The default configuration file (/etc/samba/smb.conf) allows users to view their home directories as a Samba share. It also shares all printers configured for the system as Samba shared printers. You can attach a printer to the system and print to it from the Windows machines on your network.

GRAPHICAL CONFIGURATION

To configure Samba using a graphical interface, use one of the available Samba graphical user interfaces. A list of available GUIs can be found at following address:-

http://www.samba.org/samba/GUI/.

COMMAND-LINE CONFIGURATION

Samba uses /etc/samba/smb.conf as its configuration file. If you change this configuration file, the changes do not take effect until you restart the Samba daemon with the following command, as root:
~]# systemctl restart smb.service
To specify the Windows workgroup and a brief description of the Samba server, edit the following lines
in your /etc/samba/smb.conf file:
workgroup = WORKGROUPNAME
server string = BRIEF COMMENT ABOUT SERVER
Replace WORKGROUPNAME with the name of the Windows workgroup to which this machine should
belong. The BRIEF COMMENT ABOUT SERVER is optional and is used as the Windows comment about the Samba system.
To create a Samba share directory on your Linux system, add the following section to your /etc/samba/smb.conf file (after modifying it to reflect your needs and your system):

EXAMPLE CONFIGURATION OF A SAMBA SERVER
[sharename]
comment = Insert a comment here
path = /home/share/
valid users = abc xyz
writable = yes
create mask = 0765
The above example allows the users abc and xyz to read and write to the directory
/home/share/, on the Samba server, from a Samba client.

ENCRYPTED PASSWORDS

Encrypted passwords are enabled by default because it is more secure to use them. To create a user with an encrypted password, use the smbpasswd utility:
smbpasswd -a username

STARTING AND STOPPING SAMBA

To start a Samba server, type the following command in a shell prompt, as root:
~]# systemctl start smb.service

IMPORTANT

To set up a domain member server, you must first join the domain or Active Directory using the net join command before starting the smb service. Also, it is recommended to run winbind before smbd.
To stop the server, type the following command in a shell prompt, as root:
~]# systemctl stop smb.service
The restart option is a quick way of stopping and then starting Samba. This is the most reliable way to make configuration changes take effect after editing the configuration file for Samba. Note that the restart option starts the daemon even if it was not running originally. To restart the server, type the following command in a shell prompt, as root:
~]# systemctl restart smb.service
The condrestart (conditional restart) option only starts smb on the condition that it is currently running. This option is useful for scripts, because it does not start the daemon if it is not running.

IMPORTANT NOTE

When the /etc/samba/smb.conf file is changed, Samba automatically reloads it aftera few minutes. Issuing a manual restart or reload is just as effective.
To conditionally restart the server, type the following command, as root:
~]# systemctl try-restart smb.service
A manual reload of the /etc/samba/smb.conf file can be useful in case of a failed automatic reload by the smb service. To ensure that the Samba server configuration file is reloaded without restarting the service, type the following command, as root:
~]# systemctl reload smb.service
By default, the smb service does not start automatically at boot time. To configure Samba to start at boot time, type the following at a shell prompt as root:

~]# systemctl enable smb.service

No comments:

Post a Comment