All versions of Windows, and even MS-DOS, use the SMB protocol to share files and printers, and also to handle authentication. Samba implements almost all of SMB's functionality on *NIX systems, allowing them to take the role of a Windows NT domain controller. But most of us just use it to access Windows shares on Linux. This article will help you achieving the goal.
If There are two machine ( PC ).
One has Red Hat Linux as OS and another has windows XP Professional as OS.
Both PCs are in common network.
Now if I wanna trasfer files between this two pc ( Linux PC to Windows PC or vice versa ) than how can i do that???
From that two machine no one is Server.
This article assumes you have Samba installed and properly configured, and that your kernel supports smbfs. If you're running a distro made in the last 2 years, it's safe to assume you're all set.
To access shared folders in Linux:
Open a shell.
Become root. su and enter your root password when asked for it.
Create a mount point for the shared folder. mkdir /mnt/share
Mount the shared folder. mount -t smbfs -o username=username,password=password //compname/sharename /mnt/share
Replace username with your username on the other box and password with the associated password. Replace compname with the name of the computer, and sharename with the name of the share.
If you didn't get any errors, you're all set. The folder is "mapped" to /mnt/share.
If you DID get an error, this part might help:
If the error said "can't open /etc/smb.conf: no such file" or something like that, ignore it. You don't need a config file just to mount shares.
If the error said "wrong fs type or bad superblock n //compname/sharename", it means samba isn't installed. Install it and try again.
If it said "unknown filesystem smbfs" or "kernel doesn't support smbfs" or something like that, it means you don't have smbfs support in your kernel. Run modprobe smbfs and try again. If it still doesn't work, you will have to build a new kernel with SMB support enabled.
If it says "couldn't connect to compname", open your /etc/hosts file and add an entry for the computer you're trying to connect to.
I think I've covered everything that could possibly go wrong with mounting, so let's move on to sharing.
To share directories on Linux:
Open a shell and become root, as described before.
Open your /etc/smb.conf file. kedit /etc/smb.conf (replace kedit with your favorite editor if you want)
Alter it like so:
Change the WORKGROUP setting to the name of the workgroup you want to be in.
The HOSTS ALLOW line should contain the list of IP ranges that are on your home network. For example, if your computers were all 192.168.0.* your line would look like this:
hosts allow = 192.168.0. 127.
Set ENCRYPT PASSWORDS to "yes"
Set SMB PASSWORD FILE to "/etc/smbpasswd"
On the INTERFACES line, list all of your computer's IP addresses, except the internet address if it has one. For example, if you computer had a loopback IP 127.0.0.1, an internal IP 192.168.0.1, and an internet IP 126.96.36.199, your line would be:
interfaces = 192.168.0.1 127.0.0.1
Save it and exit the editor.
Add an account for your Windows box. smbpasswd -a user password
Replace user with the username you want. and password with a password. The username should be a valid user on the Linux box.
Open up /etc/smb.conf again.
Scroll down to the Share Definitions part.
The first chunk would be the homes section. Edit it as necessary to make it match this:
comment = Home Directories
browseable = no
writable = yes
Now add any other shares you want like this:
comment = Comment
path = /path/to/share
read only = no
public = yes
Save and exit.
Now start the Samba server. nmbd -D and then smbd -D
While it's not very elaborate, or even very secure, what you have created is suitable for the home MP3 server. The hosts allow and interfaces lines are there to make the server inaccessible to anything other than the computers on your LAN, which is a pretty good security measure if you ask me.