Announcement

Collapse
No announcement yet.

Mount Windows Shares on Linux using autofs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mount Windows Shares on Linux using autofs

    Mount Windows Shares on Linux using autofs

    We will learn in this How to mount Windows Machine shares on Linux using autofs. We will use in this lab a Centos 6.3 machine and a windows 7 machine.
    Share folder is available on windows 7 machine named win-share.we will mount this share using autofs on our centos box.

    Let’s get started.

    Windows PC Details :

    Win7.broexperts.com
    IP Address 192.168.0.201
    Shared Folder win-share
    Mount Point on Linux /win-share/share

    Step-1

    Open terminal and enter this command:
    Code:
    [root@w1 ~]yum install autofs cifs-utils
    
    Output :
    
    Loaded plugins: fastestmirror, presto
    Loading mirror speeds from cached hostfile
    * c6-media:
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package autofs.i686 1:5.0.5-54.el6 will be installed
    ---> Package cifs-utils.i686 0:4.8.1-10.el6 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ================================================================================
    Package Arch Version Repository Size
    ================================================================================
    Installing:
    autofs i686 1:5.0.5-54.el6 c6-media 492 k
    cifs-utils i686 4.8.1-10.el6 c6-media 46 k
    
    Transaction Summary
    ================================================================================
    Install 2 Package(s)
    
    Total download size: 537 k
    Installed size: 3.1 M
    Downloading Packages:
    Setting up and reading Presto delta metadata
    Processing delta metadata
    Package(s) data still to download: 537 k
    --------------------------------------------------------------------------------
    Total 55 MB/s | 537 kB 00:00
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
    Installing : 1:autofs-5.0.5-54.el6.i686 1/2
    Installing : cifs-utils-4.8.1-10.el6.i686 2/2
    Verifying : cifs-utils-4.8.1-10.el6.i686 1/2
    Verifying : 1:autofs-5.0.5-54.el6.i686 2/2
    
    Installed:
    autofs.i686 1:5.0.5-54.el6 cifs-utils.i686 0:4.8.1-10.el6
    
    Complete!
    [root@w1 ~]#

    Step-2
    Now Edit /etc/auto.master file and add this entry and add entry after /misc /etc/auto.misc
    Code:
    [root@w1 ~]#vi /etc/auto.master /misc /etc/auto.misc /win-mount /etc/auto.win-mount
    Save & Exit

    Step-3

    Lets create directory which we mentioned above.

    Code:
    [root@w1 ~]#mkdir /win-moun
    t

    Step-4
    Now create auto.win-mount file under /etc/ and add this line into this file.
    Code:
    [root@w1 ~]#vi /etc/auto.win-mount
    share   -fstype=cifs,credentials=/etc/user-pass.txt ://192.168.0.201/win-share
    save & Exit
    Step-5

    Now create credentials file
    Code:
    [root@w1 ~]#vi /etc/user-pass.txt
    username=administrator
    password=Hello12
    Save & exit
    Step-6
    Now finally restart service

    Code:
    [root@w1 ~]#service autofs restart
    Confirm your shares has been mounted using this command

    Code:
    [root@w1 ~]# ls /win-mount/share
    1	2  3  4  New Text Document.txt
    Step-7
    Verify mounted share.

    Code:
    [root@w1 ~]# df -kh
    Filesystem              Size   Used   Avail Use%    Mounted on
    /dev/mapper/VolGroup-lv_root
                            1.5G   704M   739M   49%    /
    tmpfs                   250M   0      250M   0%     /dev/shm
    /dev/sda1               485M   38M    422M   9%     /boot
    /dev/sr0                3.5G   3.5G   0      100%   /dvd
    //192.168.0.201/win-share 8.0G 6.8G   1.2G   85%    /win-mount/share
    Last edited by kuldeep; 02-24-2015, 01:00 AM.
Working...
X