The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Friday, August 1, 2008

Samba configuration on Fedora Linux

Samba server implementation allows a linux system to interact with a windows network. At my home I have a router which connects my desktop PC where Windows XP professional is installed with ip address and a laptop where Fedora 7 is installed with ip address

Now configuration details for windows system :

1) I have an administrator account in my windows sytem with username "ritwikghoshal" and password (say) "windows".
2) Share directories / drives as you wish. I shared Netbeans project folder and "D" drive of my system. Just right click on the directory / drive and choose sharing.
3) Go to Control panel --> Network setup wizard --> click next --> I used the existing shared connection for the computer's internet access (i.e the recommended settings) --> Click next.
4) Computer Description : "desktop" --> Computer Name : "RITWIKD" --> Click Next.
5) Workgroup Name : "mygroup" --> Click Next --> Turn on file and printer sharing --> Next.
6) Just finish the wizard

Configuration details for Linux system :

1) Ping test : First I performed a ping test to check if windows system is reachable
[root@ritwik ~]# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=128 time=10.2 ms
64 bytes from icmp_seq=2 ttl=128 time=2.24 ms
64 bytes from icmp_seq=3 ttl=128 time=2.06 ms
64 bytes from icmp_seq=4 ttl=128 time=1.85 ms

--- ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 1.854/4.103/10.253/3.553 ms

2) Check whether Samba is installed :
[root@ritwik ~]# smbd -V
Version 3.0.28-0.fc7

If you don't get any o/p like "Version 3.0.28-0.fc7" that means you don't have samba installed. Then try to install it first.

3) set Firewall to consider samba as trusted service :
System -> Administration -> Firewall and SElinux
Now check samba in Firewall option's trusted services.

4) Service Configuration :Start "smb" services
System -> Administration -> server settings -> services
Start smb service.

5) Samba Server Configuration :
System -> Administration -> samba

I. Server settings : Preferences -> Server settings
Here workgroup name would be same with windows' workgroup name i.e "mygroup". (windows config : step 5).

II. Samba Users : Preferences -> Samba users -> Add user
windows' username : it would be same with the username of your windows system , mine was "ritwikghoshal" (windows config : step 1).
setup a password , mine was "fedora".

III. Add share : add a directory , give a sharename , set necessary permissions . Description field is optional. I shared three directories from my home directory : software, study and NetBeans project folder.

6) Restart samba service :
System -> Administration -> server settings -> services
Restart smb service.

Access windows' share from Fedora 7 :

After following the abovesaid steps I checked the Network directory.It contained 4 icons : "RITWIK" , "ritwik's public files on ritwik" , "SFTP File Transfer on ritwik" , "Windows Network".
"RITWIK" : contained shared files of fedora (study, software , nbproject dir etc.)
"ritwik's public files on ritwik" : contained nothing
"SFTP File Transfer on ritwik" : contained root directory.
"Windows Network" : contained 2 icons , 'mshome' & 'mygroup'.
'mshome' had 'RITWIKD' where I found all windows' shared files.
'mygroup' contained same 'RITWIK' directory.

Access Fedora's share from windows :
Go to start -> Run -> open : \\
Hit the return key and a browser window will display all shared files of Fedora system.

So... you are done !!!

You may also like to use commands than GUI , in that case ..
Configure IPTABLES for firewall issue
start / restart smb service by using commnds like :
/etc/rc.d/init.d/smb start
/etc/rc.d/init.d/smb restart
Edit /etc/samba/smb.conf and /etc/samba/smbusers to configure samba server.
I have used the following command to mount windows' "E" directory to my fedora home, in a directory named "WinShare".
[root@ritwik ~]# mount -t cifs -o username=ritwik,password=fedora,ip= //Ritwikd/E /home/ritwik/WinShare
.. and the following one to unmount :
[root@ritwik ~]# umount /home/ritwik/WinShare

No comments:

Post a Comment