Integrating windows and linux File System PART – 1(FROM LINUX TO WINDOWS)

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

e.g.

$smbclient  -L \\192.168.0.8

or

$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:

username=winusername

password=winpassword

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:

smb:\>

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 .

Advertisements

About Divyashree - The GNULINUX Guy

I am a Linux and Opensource enthusiast. I started working on Linux early in 2007 while I was doing my Masters in Computer Science and passed out in 2010. Currently working as a DevOps in in Public/Private cloud domain. my @github : https://github.com/kumarprd my @nagiosexchange : https://exchange.nagios.org/directory/Owner/divyaimca/1 my @linkedin : https://www.linkedin.com/in/priyadarshee-kumar-☁-a9415615
This entry was posted in HOWTO, TIPS & T RICS, TUTORIALS. Bookmark the permalink.

2 Responses to Integrating windows and linux File System PART – 1(FROM LINUX TO WINDOWS)

  1. cl says:

    Hello, I’ve did this with cifs. Seems that cifs is more safe than smbfs.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s