LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   using fstab to mount windows xp shares (https://www.linuxquestions.org/questions/linux-networking-3/using-fstab-to-mount-windows-xp-shares-151724/)

yeateke 02-28-2004 11:01 PM

using fstab to mount windows xp shares
 
I've found a lot of great info about this topic here, but haven't found an answer to my problem. Here it is...

I am trying to mount a Windows XP share through /etc/fstab. I've added the following line into my fstab:

//KC01/Documents /Winshare smbfs auto,gid=users 0 0

When I start the computer, the boot log shows the following:

Mount SMB File System from /etc/fstab done
Password: SMB connection failed

In attempting to investigate the problem on my own, I opened a console and successfully used the following command to mount the Windows XP share:

mount -t smbfs //KC01/Documents /Winshare

However, after entering this, I am prompted for a password. Seeing as the Windows XP share is not set up to need a password (I am using Simple File Sharing, and have checked the option "Allow network users to change my files"), I merely press Enter, and the share successfully mounts. The problem is the password prompt. It's causing the line in fstab to fail. I've tried adding a 'password=' to fstab, but that just causes a failure as well.

Any suggestions on how I can either get rid of the password prompt, or possibly send a null password?

motub 02-29-2004 05:27 AM

I'm sure there's some elegant solution to this problem using fstab itself, but I didn't have the patience to look for it when I had a similar problem, so here's the "inelegant-but-it-works" solution:

Remove the lines from etc/fstab (cut and paste them to a "spare text" text file if you want to fiddle with this again in the future), and install LinNeighborhood (or use it if you have it already installed).

Go to the Edit=>Preferences menu and set your options, such as always scan as user, ask for user/pasword once, etc. in the Scan tab, default username and password in the Miscellaneous tab (even though LinNeighborhood does not seem to actually use the saved password info from this dialog when needed). Also in the Miscellaneous tab, set your default mount point and check "Memorize mounted shares and remount on startup". Do not check "Don't show mount dialog, just use defaults" at this time (you may be able to do so later, but I never use it so I don't know, although now that I think about it this may be why LinNeighborhood has never seemed to use the default user info).

Save and go back to the main window. Scan the network (you should get a u/p dialog once) and select the share you want to mount. Right-click and choose "mount" (easy enough, since it's the only entry in the right-click menu). A dialog will pop up with a guess as to your desired mount point (adjust if desired), the UID and GID of the mount point (adjust if desired and you have the permissions to do so) and the username and password for authentication on the SMB machine that you are mounting from. Put in the username and the null password and see if it mounts. If so, set up your other mounts as well.

Now, the only "gotcha" here is that the LinNeighborhood setting for "Memorize mounted shares and remount on startup" refers to LinNeighborhood startup, not system startup. So you have to add "LinNeighborhood -m" to your session so that LinNeigborhood starts without GUI when you log in, mounts the memorized shares, and then exits. Under Gnome this can be done by going to the GNOME Control Center=>Advanced=>Sessions and adding "LinNeighborhood -m" to the Startup Programs. Under KDE I believe this is done by adding a launcher pointing to "LinNeighborhood -m" in the .kde/Autostart folder in your $HOME$ (turn on "View Hidden Files" in Konqueror if you don't see the .kde folder). Or you could write a bash script, if you use another WM, or don't use X at all.

Hope this helps.

andrewlkho 02-29-2004 07:47 AM

The "elegant" solution to this is to put:
password=
in the options section of your fstab entry. This is equivalent to:
mount -t smbfs //KC01/Documents /Winshare -o password=

motub 02-29-2004 07:56 AM

Excellent! (I've always wanted to be elegant ;) ) Hope it helps yeateke too, but I'm looking forward to trying it myself.

Thanks, ho_10!

yeateke 03-01-2004 08:19 AM

I tried out the 'elegant' method with mixed results. Sometimes it works, and sometimes it doesn't. I think though that this is more of a problem on the MS side with their file sharing. When it doesn't work, all I have to do is su to root and type "mount -a" to get it functioning.

Thanks for the tips!


All times are GMT -5. The time now is 02:30 PM.