Tuesday, April 19, 2011

SAMBA - Windows Linux file Sharing Notes

Some basic notes on using SAMBA on a home network with linux and windows machines, like my home network setup.

Running SAMBA on a Linux machine

To start, stop or restart samba,
/etc/init.d/smd start
/etc/init.d/smd stop
/etc/init.d/smd restart
All options for the SAMBA goes to /etc/samba/smb.conf This is my smb.conf
Notable changes I made are:
My linux machine is a gateway server with two ethernet interfaces eth0 and eth1. For security reasons I set up SAMBA to run only on the internal interface
interfaces = 192.168.0.1/24 127.0.0.1/24
bind interfaces only = Yes
Also set hosts allow to only allow internal and localhoist
hosts allow = 127. 192.168.0.
hosts deny = *

SAMBA authentification

For the file access permissions for the shares to work, you have to set up the SAMBA username/password by running smbpasswd program on the linux box.
Then on the Windows machine login with the username/password created above with smbpasswd. Otherwise the file sharing will not work.


SAMBA Linux to Windows Sharing

Set up the shares in /etc/samba/smb.conf as follows

[musak]
        comment = music from linux boxen
        path = /var/stuff/media/musak
        read only = Yes
On the windows machine access it as \\192.168.0.1\musak where 192.168.0.1 is the IP address of the linux machine.
If you want to share CD/DVD drive

[dvd]
        comment = dvd drive on linux boxen
        writable = No
        locking = No
        path = /mnt/cdrom2

SAMBA Windows to Linux Sharing

First turn on file sharing. Go to Start->Setting->Control Panel and open "Network" and in the first tab called "Configuration" click on "File and Pring Sharing..." and om the Dialog Box that comes up check "I want to be able to give others access to my files"
Now go to the file explorer and right click on the folder you want to sgare, and from the menu that pops up slect "Sharing..." and from the "Manual Properties" Dialog Box that comes up select the second tab "Sharing" and select "Shared as" which will enable all the text boxes, fill in the "Share Name" "Comments" and selct "Read Only" "Full" or "Depends on Password" and enter a password. This is the password that will give access to this share. Also note the "Share Name", lets name it "MYSHARE".
Also find out the hostname of the Windows machine. Go to Start->Setting->Control Panel and Open "Network" and in the second tab "Identification" note the "Computer Name", This is the name to use from Linux to access shares on this machine. Let it be "MYWINBOX"
Now go to the Linux machine. Crete mount point for the share.
mkdir /mnt/winstuff 
Mount the share named "MYSHARE" on Windows hos namedt "MYWINBOX"
smbmount \\MYWINBOX\MYSHARE /mnt/winstuff 
This will prompt you for the password for the share, enter the password and after that if you go to /mnt/winstuff you can access all files on the Windows folder.

0 komentar:

Post a Comment