Mailinglist Archive: opensuse (3513 mails)

< Previous Next >
Re: [opensuse] CIFS mount question
  • From: "David C. Rankin" <drankinatty@xxxxxxxxxxxxxxxxxx>
  • Date: Wed, 07 Jan 2009 23:11:27 -0600
  • Message-id: <49658AFF.90201@xxxxxxxxxxxxxxxxxx>
Simon Roberts wrote:
Hi all,

I'm trying to configure a friend's laptop (OpenSuSE 11.1/Gnome) to auto mount
a windoze share.

I have a line in the /etc/fstab file like this:

//192.168.2.3/Export /home/user/mnt cifs
user=user,password=secret,uid=user,soft 0 0

Now, this works just fine and dandy if I issue a call to "sudo mount -all"
but I'd like to find a way to have the system create the mount automatically
as soon as it determines that it is able. I had hoped that the "soft" element
in the options might persuade it to do something on those lines, but no luck.

Anyway, any suggestions how I should do that?

Also, I've noticed that the mount takes quite a time to start up (and using
smbclient with heavy debug enabled, I noticed that the system was trying all
kinds of things before it finally settled on a way to connect successfully)
Any suggestions how I tune it to try only the "successful" approach?

TIA
Simon


"You can tell whether a man is clever by his answers. You can tell whether a
man is wise by his questions." — Naguib Mahfouz


Simon,

I just use a bash script to mount the shares. I create a script for each
machine I want to mount and then for a collection of machines, I just create
another small script that calls for the mount of all machines in one location
like home or office, etc. Note the OPTS below just allows you to separate the
credentials from the script to prevent disclosure of passwords, etc. The
following is what I use to mount 3 shares from one machine on my laptop. I use
smbclient to test for the availability of the share before calling mount.cifs:

22:17 alchemy:~> cat bin/mount_nirvana
#!/bin/bash

# . /home/david/linux/scripts/include/general.inc
# check_root

SERVER="//nirvana"

if smbclient -U% -L${SERVER} >/dev/null 2>&1; then

OPTS=$(cat /home/david/bin/mntops_dcr)

SHARE="/config"
MPOINT="/mnt/nirvana-cfg"

if mount | grep -q "on ${MPOINT} type"; then
echo "${MPOINT} already mounted"
else
if [[ ! -d ${MPOINT} ]]; then
sudo mkdir -p ${MPOINT} >/dev/null 2>&1
fi
sudo mount.cifs ${SERVER}${SHARE} ${MPOINT} ${OPTS}
fi

SHARE="/samba"
MPOINT="/mnt/nirvana"

if mount | grep -q "on ${MPOINT} type"; then
echo "${MPOINT} already mounted"
else
if [[ ! -d ${MPOINT} ]]; then
sudo mkdir -p ${MPOINT} >/dev/null 2>&1
fi
sudo mount.cifs ${SERVER}${SHARE} ${MPOINT} ${OPTS}
fi

SHARE="/david"
MPOINT="/mnt/nirvana-david"

if mount | grep -q "on ${MPOINT} type"; then
echo "${MPOINT} already mounted"
else
if [[ ! -d ${MPOINT} ]]; then
sudo mkdir -p ${MPOINT} >/dev/null 2>&1
fi
sudo mount.cifs ${SERVER}${SHARE} ${MPOINT} ${OPTS}
fi


exit 0

fi



--
David C. Rankin, J.D.,P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages