Samba is a software package which gives users flexibility to seamlessly share Linux/Unix files with Windows client and vice-versa. Samba installation, configuration and file sharing is very simple on oracle linux.
Why is the need of Samba?
Let's say you’re managing two operating systems - Linux and Windows on the same computer, dual booting every day, switching between the platforms depending upon your requirement. Perhaps you’re planning to eventually move to Linux as your main operating system; or probably Windows; you might even have plans to remove Microsoft’s OS from your computer at some point soon.
One of the things holding you back is the ability to access data between operating systems. Or assume another scenario where you are running various component of Big Data architecture (Data Collection & Processing) on Linux machine but Visualization tool demands Windows file system only.
Let’s see how we can work around this problem, and get your data where you want it. I am not saying Samba is the "only" solution for this problem but yes it is one of the best solution - no cost, real-time file sharing & super-fast; what else you need?
What is Samba?
Samba is a software package which gives users flexibility to seamlessly share Linux/Unix files with Windows client and vice-versa.
With an appropriately-configured Samba server on Linux, Windows clients can map drives to the Linux file systems. Similarly, Samba client on UNIX can connect to Windows shares. Samba basically implements network file sharing protocol using Server Message Block (SMB) & Common Internet File System (CIFS).
Installation and configuring Samba (v3.6) on Linux machine (RHEL/CentOS):
1. Execute below command on your terminal to install samba packages:
yum install samba samba-client samba-common -y
2. Edit the configuration file /etc/samba/smb.conf
mv /etc/samba/smb.conf /etc/samba/smb.conf.backup
and copy-paste below details in configuration file.
workgroup = EXAMPLE.COM<enter name according to your workgroup, right click on your computer properties in main menu to get it (domain or workgroup)>
server string = Samba Server %v
netbios name = centos
security = user
map to guest = bad user
dns proxy = no
#======== Share Definitions ===========================
path = /samba/anonymous
writable = yes
guest ok = yes
read only = no
3. Now save the configuration file and create a Samba shared folder. Then, restart Samba services. Run below commands step by step:
mkdir -p /samba/anonymous
chmod -R 0755 anonymous/
chown -R nobody:nobody anonymous/
chcon -t samba_share_t anonymous/
systemctl enable smb.service
systemctl enable nmb.service
systemctl restart smb.service
systemctl restart nmb.service
4. You can check samba services by running ps -eaf | grep smbd; ps -eaf | grep nmbd
5. Now go to the windows Run prompt and type \\yourhostname\anonymous. Thats it!! You will be able to access anonymous shared drive by now.
6. If this doesn't connect to the shared folder. Please make sure your firewall services are stopped and try again. You can run below commands to stop the services.
service firewalld stop
service iptables stop
7. Now test shared folder by creating a sample text file on linux machine and opening it on windows machine.
You can find complete Samba documentation at below mentioned link. It's very well documented and can be easily understood.
If you enjoyed this post, please comment if you have any question regarding Samba Installation (on any operating system) and I would try to response as soon as possible. Thank you!
Interested in learning Apache Spark?
Main menu: Spark Scala Tutorial
1. Apache Spark and Scala Installation
2. Getting Familiar with Scala IDE
3. Spark data structure basics
4. Spark Shell
5. Reading data files in Spark
6. Writing data files in Spark
7. Spark streaming