linux samba server : Basic of samba server

What is samba server?

Samba is an Open Source/Free Software suite that provides file and print services to SMB/CIFS clients. Samba is freely available, unlike other SMB/CIFS implementations, and allows for interoperability between Linux/Unix servers and Windows-based clients.

Samba uses the TCP/IP protocol that is installed on the host server. When configured, it allows that host to interact with a Microsoft Windows client or server as if it is a Windows file and print server.

Why Samba?

Most Linux systems are the part of networks that also run Windows systems. Using Linux Samba servers, your Linux and Windows systems can share directories and printers. This is most use full situation where your clients are window native and you want to use the linux security features.

  • You will be able to connect NT files from Unix/Linux system.
  • It makes a common area for data or user directories in order to transition from a Windows server to a Unix one, or vice versa.
  •  It helps to share printers across both Windows and Unix workstations.
  • You can use samba server as a file server.

Samba reached its prominence in large part because it allows unmodified Windows stations to talk to it, and since Windows is typically the largest population of Desktop users on any given network that makes it more interesting. The other population, Mac users, can use the not-well-maintained Netatalk package, or much more commonly the Samba package built into their OS. In short, Samba is da bomb because it works the best in heterogeneous networks.

The pure open-source file-serving solutions with unquestionable patent exposure out there are not that desktop-user friendly. NFS is pretty much it, which requires a root-mount and until very recently had very little in the way of built in security features. The FuseFS packages have gone a LONG way to making this a lot easier for desktop-linux users, as it allows things like SSH/SFTP to be a file serving protocol instead of a file sharing protocol; File -> Save -> Browse to location, will work with FuseFS.

Is Microsoft’s network file system so good?

From the perspective that it is everywhere, then yes it is good. If you are asking if it is a good protocol, then the answer is that it isn’t really all that great. It has large problems on links with high latency. It has far too many redundant commands. Microsoft has fixed a lot of this with SMB2.

Installation of Samba

yum -y install samba

Configure a fully accessed anonymous share

Create a directory called ‘/samba/test1′ and set full permission

[root@sambaserver ~]# mkdir -p /samba/test1
[root@sambaserver ~]# chmod -R 0777 /samba/test1/

Edit and add the following lines in samba config file as shown below

[root@sambaserver ~]# vi /etc/samba/smb.conf
## Line no 58 – Add the following lines below line 58 ##
unix charset = UTF-8
dos charset = CP932
## Line no 75 – Change the to windows default workgroup ##
workgroup = WORKGROUP
## Line no 81 – Uncomment and set the IP Range ##
hosts allow = 127., 192.168.1.
## Line 102 – set no authentication ##
security = share
## Add the following lines at the bottom ##
[myshare]
path = /samba/test1
writable = yes
browsable = yes
guest ok = yes
guest only = yes
create mode = 0777
directory mode = 0777

Start samba server

[root@sambaserver ~]# vi /etc/samba/smb.conf
[root@sambaserver ~]# /etc/init.d/smb start
Starting SMB services: [ OK ]
[root@sambaserver ~]# /etc/init.d/nmb start
Starting NMB services: [ OK ]
[root@sambaserver ~]# chkconfig smb on
[root@sambaserver ~]# chkconfig nmb on

We can test the Samba server configuration using the command ‘testparm’.

[root@sambaserver ~]# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section “[homes]”
Processing section “[printers]”
Processing section “[myshare]”
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
dos charset = CP932
server string = Samba Server Version %v
security = SHARE
log file = /var/log/samba/log.%m
max log size = 50
hosts allow = 127., 192.168.1.
cups options = raw

[homes]
comment = Home Directories
read only = No
browseable = No

[printers]
comment = All Printers
path = /var/spool/samba
printable = Yes
browseable = No

[myshare]
path = /samba/share1
read only = No
create mask = 0777
directory mask = 0777
guest only = Yes
guest ok = Yes

Disable SELINUX

[root@sambaserver ~]# vi /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted – Targeted processes are protected,
# mls – Multi Level Security protection.
SELINUXTYPE=targeted

Now restart service. You can also stop the firewall service.

[root@sambaserver ~]# service iptables stop

[root@sambaserver ~]# servcie smb restart

Now you can access this share folder from windows. by start > run> >IP

access smb share from windows
access smb share from windows

 

 

Satya Prakash

VOIP Expert: More than 8 years of experience in Asterisk Development and Call Center operation Management. Unique Combination of Skill Set as IT, Analytics and operation management.

Leave a Reply