SAMBA
Samba is one of the most used, and important server in any industry that prefers Linux Servers, with Windows Clients.
For sharing files which are located in your Linux System, Samba servers are set up with all the clients using Windows Operating System.
So samba is quite handy, because you don’t have to go takes files in Pen-drive from the Linux machine and paste it in your machine. Just setup a Samba share in your Linux system, and give the IP of that system to all windows clients.
Once they put IP with ‘\’ in run, the share would be right in-front of them, provided they exist on the same Network.
This configuration is same for Debian based Operating system and Red-hat based Operating Systems.
Just for Debian based Operating system, use ‘apt-get’ instead of you in step 1.
So to set up and configuring a Samba Server follow these steps.
1. yum install samba
Install samba with yum, if you don’t have it.
2. vi /etc/samba/smb.conf
Once Samba is installed, Create a backup of the conf file which is located in /etc/samba. Then open its configuration file using vi or any of your favorite editors.
3. Go to the end. You’ll see the share definitions.
That is how to define a share in Samba.
First line indicates the ‘Name’ of the Share.
The ‘Path’ shows the path of the folder, you want to share.
If ‘Browserable’ is yes, you can browse that folder.
If ‘Writable’ is yes you can write in the files of that folder.
You can even define writable only for a specific group using ” +’groupname’ “.
Valid users contain the list of users, or groups who can use that folder.
If ‘guest ok‘ is yes, any guest can use that folder.
4.
groupadd 'groupname'
useradd 'username'
usermod -G 'groupname' 'username'
The groupadd command will add a new group. Useradd is used to add a new user in the Operating System.
usermod -G ‘groupname’ ‘username’ is used to add that new user to the earlier group we created. The -‘G’ switch is used to add a particular user to particular group.
5. smbpasswd -a 'username'
smbpasswd -a is used to assign a password to a particular user of that group.
6. /etc/init.d/smb restart
/etc/init.d/nmb restart
Since you changed the configuration service, restart ‘smb’ and ‘nmb’ services. If you’re services are running, they would restart, if they are not running. it’ll start the service.
7. ifconfig
Check your machine’s IP with ‘ifconfig’ command. Remember that IP, because you will need it when you want to connect from windows.
8. Enter IP of Linux Machine in ‘run’.
Open run in any windows machine that is in the same network, as of our Samba Server and enter’\[ip]’
where [ip]= IP address of Linux Machine.
9. Enter Password.
Since you gave a password to particular username using ‘smbpasswd’ command, it will ask you the username and password. Make sure that you enter that particular username and that password. Else you won’t get access to the samba share.
10. Check your share.
Just check if you can see the names of the share that you gave in the share definition above.
11. Try opening those shares.
So this is how you configure a Samba server, to share folders and files with Windows clients .