16

I am trying to setup a script that will:

  1. Connect to a windows share
  2. Using LOAD DATA LOCAL INFILE, upload the two files into their appropriate db tables
  3. Umount share

Situation:
I can currently vpnc into this remote machine

Problem:
I cannot

mount -t cifs //ip.address/share /mnt/point -o username=u,password=p,port=445
mount error(110)  Connection timed out

I am attempting to do this manually first
Remote server is open to port 445

Questions:

  1. Do I even need to vpnc in first?
  2. Do I need to do route add for the remote ip/mask/gw after vpnc?

Thank you!

Alex Weitz
  • 3,199
  • 4
  • 34
  • 57
richardwhitney
  • 506
  • 1
  • 6
  • 21

2 Answers2

39

The mount.cifs file is provided by the samba-client package. This can be installed from the standard CentOS yum repository by running the following command:

yum install samba samba-client cifs-utils

Once installed, you can mount a Windows SMB share on your CentOS server by running the following command:

Syntax:

mount.cifs //SERVER_ADDRESS/SHARE_NAME MOUNT_POINT -o user=USERNAME

SERVER_ADDRESS: Windows system’s IP address or hostname

SHARE_NAME: The name of the shared folder configured on the Windows system

USERNAME: Windows user that has access to this share

MOUNT_POINT: The local mount point on your CentOS server

I am mounting to a share from \\10.11.10.26\snaps

Make a directory under mount for your reference

mkdir /mnt/mymount

Now I am mounting the snaps folder from indiafps02, User name is the Domain credentials, i.e. Mydomain in this case

mount.cifs //10.11.10.26/snaps /mnt/mymount -o user=Girish.KG

Now you could see the content by typing

ls /mnt/mymount

So, after performing your task, just fire umount command

umount /mnt/mymount

That's it. You are done.

CODE-REaD
  • 2,819
  • 3
  • 33
  • 60
Girish KG
  • 1,074
  • 11
  • 4
  • 6
    What about `cifs-utils`? I had to install this as well. – djhurio Apr 03 '14 at 12:04
  • After much deliberation and squabbling about I just installed PHP on the windows server and curled the files up to my server - works a charm - I did this over a year ago. – richardwhitney Feb 24 '15 at 07:27
  • After installing the samba-client, mount.cifs is not recognized – Shai Alon Mar 04 '19 at 13:56
  • I have done small modification to achieve the required result i.e mount.cifs //{IP/hostname}/{sharedfolder} {/home/virtual_machine_folder} -o username=username,password="" ,vers=2.0 – mangeshbhuskute Jun 07 '19 at 08:03
  • Hello: @girish-kg Any idea how this is not working for my case? I've been facing mount error(112): Host is down ISSUE mount.cifs //IP/cloudfolder /lib_core -o user=root – Rajendra Maharjan Dec 25 '19 at 07:47
1

no need to install "samba" and "samba-client", only "cifs-utils" using command

yum install cifs-utils

after that in windows share the folder you would like to mount in centos if you didn't do that already ("c:\interpub\wwwroot" in my case).

make sure you share it with a specific username whom your know the password for ("netops" in my case).

create a directory in centos in which you would like to mount the windows share in to ("/mnt/cm" in my case).

after that run that simple command as a root

mount.cifs //10.16.0.160/wwwroot /mnt/cm/ -o user=netops

centos will prompt you for the windows username password.

you are done.