LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-16-2004, 09:03 AM   #1
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 365

Rep: Reputation: 30
Mounting Windows shares in fstab


Having a tough time figuring out the fstab entry that will auto mount
my Win2K shares.

I can always use:

smbmount //win2K/C /mnt/share
Password: [ENTER] (null passwords in smb.conf)

and the share is mounted.

However I would like to automate this and have tried all of the following
to no avail:

//win2K/C /mnt/share smbfs username=administrator,password=default,rw,uid=root,gid=root 0 0

//win2K/C /mnt/share smbfs defaults,rw,noauto,user=xxxxxxxx,password=xxxxxxxx 0 0

//win2K/C /mnt/share smbfs credentials=/etc/samba/win2K 0 0

and a few minor variations on the above.

Does anyone know the proper string for my Slackware 9.0 system?
 
Old 10-16-2004, 09:16 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
looks fine to me. what actaully happens with that middle entry when you just try "mount /mnt/share" ?
 
Old 10-16-2004, 01:07 PM   #3
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 365

Original Poster
Rep: Reputation: 30
Not sure what you mean by 'just try "mount /mnt/share" ?'; I'll assume you mean

mount -t smbfs //win2kbox/C /mnt/share

which works fine also and seems to be all that is required.

Each of the commands (smbmount or mount) seem to work as long as it
is executed from the command line in a console.

It just doesn't want to work in fstab.
 
Old 10-16-2004, 03:40 PM   #4
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 365

Original Poster
Rep: Reputation: 30
This may not be the proper forum for this note, but it bears on a solution to
the smbmount problem.

I thought that I would write a script to mount the windows share on
startup without user intervention. Unfortunately, using the familiar command:

smbmount //win2K/C /mnt/share

requires user intervention when the mount command requests a password, even
though the response only requires one to press [ENTER].

A way to automate this sequence would seem to beg the use of 'expect'. An expect
script like the following should work:

#! /usr/bin/expect -f
spawn smbmount //amdk7/C /mnt/share
expect "Password:"
send "\r"

This script seems to work well up until the last statement; the one supposedly
sending the [ENTER] character. On a Linux system the ENTER key is supposed to represent
a linefeed (\n), but expect tutorials say the \r is required at the end of a send statement.

However, nothing I have tried [send "\r", "\n", "\0x1c\0x9c"(showkey -s)] has worked.

Anyone have a suggestion?
 
Old 10-16-2004, 05:16 PM   #5
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 365

Original Poster
Rep: Reputation: 30
After a little more reading and playing around, a working 'expect' script:

#! /usr/bin/expect -f
spawn smbmount //amdk7/C /mnt/share
expect "Password:"
exec sleep 1
send "\r"
expect eof

I thought a reference to this in rc.local should work well, but I get an access
denied error. Could be related to the fact that the mount occurs prior to
login (as root). There must be someway around this.

But once logged in, it works well.

Aliasing a short name to the location of the file (such /etc/samba/mntshrs) is a
quick way to mount the share(s).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
using fstab to mount windows xp shares yeateke Linux - Networking 4 03-01-2004 08:19 AM
mounting w2k shares in fstab GraemeK Linux - Networking 2 01-30-2004 04:49 AM
Mounting Windows Shares ilumin8d Linux - Networking 4 07-15-2003 02:36 AM
Mounting Windows Shares Thermos Linux - Networking 3 07-09-2003 01:34 PM
mounting windows shares Moebius Linux - Newbie 12 12-19-2002 08:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration