It is too much easy to share resources of windows and linux on both hosts. We can easily share the shared file between windows nad linux . This all happen due to SMBFS/CIFS (Common Internet File System) which is supported by windows by default and by samba in linux. So we have to install samba client in linux in order browse windows shares and have to install samba server to browse linux shares in that can be browsable by windows. Just follow the steps to make it happen in all versions of windows and most GNU/Linux versions like RHEL,SUSE,CENTOS,FEDORA,UBUNTU,CLEAROS which I have tested.
PART – 1 : SHARING WINDOWS FILES IN GNU/LINUX CLIENT
Install samba client on RHEL,CENTOS,CLEAROS,FEDORA,SUSE
$sudo yum install samba-client
Install smbfs on ubuntu.
$sudo apt-get install smbfs
Now from linux we can check in command line which drive and folder on a windows hosts are shared. supply the following command:
$smbclient -L \\ IP of the windows client or computer name
$smbclient -L \\192.168.0.8
$smbclient -L \\pdk
where pdk is the Computer name of the the windows host.
Now we have to mount the windows shares in the GNU/linux client to browse or we can use downnload and upload the data by command line.
Create a permaent directory in linux where you can mount the windows shares.
$sudo mkdir /mnt/windows
Now mount the required windows share on the linux by the following command,
$sudo mount -t cifs //windowshost/share /mnt/windows -o user=winusername,pass=winpassword
Now the windows share in mounted in a linux directory. Now we can check the contents by ls -l option or using nautilus browser. Now to make the mount after each time the GNU/linux system reboots we have to enable automount that is we have to add the following line in /etc/fstab:
//windowshost/share /mnt/windows cifs credentials=/etc/samba/cifs.secret,noexec 0 0
By addng this line in fstab file of linux, will automount the windows partition, after each time it boots.
Now we have to create a secret file(/etc/samba/cifs.secret) with a limited permission ,where we can store the username and password information to mount the windows partition.
$sudo touch /etc/samba/cifs.secret
Now open the file with your favourite editor and add the username and password in this file.as:
Now to make the file read only by the owner by
$sudo chmod 0400 /etc/samba/cifs.secret
Now supply the command
$sudo mount -a
Now the windows share will be mounted permanently on the mentioned (/mnt/windows)linux directory .
Another nice thing is we can browse the windows shares by command line as in ftp in smb prompt as follows:
$sudo smbclient //windowshost/share -U winuser -W windomain
Now after supplying this command a prompt like this will come:
Now from here the commands like ls,dir,mput,mget,cd,mkdir,clear can be run.
Like I said before, we can use nautilus to browse the shares all over our LAN. The option is in COmputer==>Network
Like this printer can be shared. IN the next part I will tell how we will access linux shares from windows .