LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 06-26-2005, 12:16 PM   #1
FlamingBee
Member
 
Registered: Mar 2005
Distribution: Mandrake 10.2
Posts: 35

Rep: Reputation: 15
Auto-Mounting a Windows Share On Starup


I am currently attempting to network my windows XP and linux (Mandrake 10.2 Le2005) systems together. I have managed to get the machines on the windows network to mount using:

mount -t smbfs //omoikane/"phobos (d)" /home/user/Network/omoikane/phobos

where omoikane is the name of the windows system and "phobos (d)" is the share directory that i wish to mount. This command works fine, however i have to re-do this every time i restart mandrake (for all of my drives and partitions from 3 systems...). I am wondering how one can set up linux to auto do this when the system starts. I have tried editing /etc/fstab using

//omoikane/phobos /home/user/Network/omoikane/phobos smbfs 0 0

but this does not work (unsure of the exact error - is there a log file kept somewhere that tells me of the errors?)

Having looked over the tutorials on the site and searched on the internet I have been unable to work out why the above command does not work. Also, is there another way of doing it rather than fstab (a script that I can run when the machine starts that opens a command line and logs in a root then runs the first command i mentioned)?

Any help would be appreciated, as this problem is driving me up the wall!
 
Old 06-26-2005, 12:43 PM   #2
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
just add the command to your /etc/rc.local or /etc/rc.d/rc.local file...

(i'm not exactly sure where the rc.local file is on mandrake...)


Last edited by win32sux; 06-26-2005 at 12:47 PM.
 
Old 06-27-2005, 10:36 AM   #3
FlamingBee
Member
 
Registered: Mar 2005
Distribution: Mandrake 10.2
Posts: 35

Original Poster
Rep: Reputation: 15
Which command should I add to the rc.local? I tried adding mount -t smbfs //omoikane/"phobos (d)" /home/user/Network/omoikane/phobos to the file before, but It had no success.
 
Old 06-27-2005, 10:40 AM   #4
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Quote:
Originally posted by FlamingBee
Which command should I add to the rc.local?
whichever command you already know works fine... adding it to your rc.local would give the same effect as if you had run the command as root after startup... from your first post i would assume the command you want to append to that file is:
Code:
mount -t smbfs //omoikane/"phobos (d)" /home/user/Network/omoikane/phobos
 
Old 06-27-2005, 10:41 AM   #5
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Rep: Reputation: 46
Alternate title for this topic: "How to make mounting needlessly complicated" ;) (it's a joke. Smile. Relax.)

Here is the easy way via /etc/fstab:

Code:
//servername/sharename /mountpoint smbfs uid=username,gid=users,username=domainuser,password=domainpassword 0 0
Where
servername = server name of the SMB/Domain server
sharename = shared resource name
/mountpoint = directory you want to mount the filesystem on (example: /mnt/samba)
username = *nix username
domainuser = smb/domain/active directory username
domainpassword = the password in samba/domain/active directory for the domainuser
 
Old 06-27-2005, 11:19 AM   #6
FlamingBee
Member
 
Registered: Mar 2005
Distribution: Mandrake 10.2
Posts: 35

Original Poster
Rep: Reputation: 15
tried both of those, no success. In /etc/rc.d/rc.local there is:

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.



touch /var/lock/subsys/local

#Bring acx100 device up
cd /home/user/acx100-0.2.0pre8_plus_fixes_57/scripts
./start_net

#mount windows filesystem
mount -t smbfs //omoikane/"mars (k)" /home/user/Network/omoikane/mars
mount -t smbfs //omoikane/phobos /home/user/Network/omoikane/phobos

In Fstab I have added:

//omoikane/phobos /home/user/Network/omoikane/phobos smbfs uid=user,gid=users,username=user,password=xxxx 0 0

//omoikane/"mars (k)" /home/user/Network/omoikane/mars uid=user,gid=users,username=will,password=xxxxx 0 0

(In order to test it I added both formats). I'm not quite sure what you mean by:

uid=users,gid=users and, most especially, domainuser and domain password. Are they the user/password of the Windows PC i'm trying to share with?

Bah, sorry about being so "noobish" but I can't help it
 
Old 06-28-2005, 12:36 PM   #7
FlamingBee
Member
 
Registered: Mar 2005
Distribution: Mandrake 10.2
Posts: 35

Original Poster
Rep: Reputation: 15
No one any idea how to fix this? Or alternative methods to resolve the problem.
 
Old 06-29-2005, 06:01 AM   #8
stefan_nicolau
Member
 
Registered: Jun 2005
Location: Canada
Distribution: Debian Etch/Sid, Ubuntu
Posts: 529

Rep: Reputation: 32
Quote:
(In order to test it I added both formats). I'm not quite sure what you mean by:

uid=users,gid=users and, most especially, domainuser and domain password. Are they the user/password of the Windows PC i'm trying to share with?
uid and gid are for the linux user that should own the files when mounted
username and password are login credentials for the windows pc

To mount it, as root, do 'mount /home/user/Network/omoikane/mars'

NOTE: username and password stored in /etc/fstab are world-viewable (bad)
see man smbmount for information about using a credentials file instead.

Also, you must specify smbfs as the filesystem type.

If this fails, please post any error messages.

Last edited by stefan_nicolau; 06-29-2005 at 06:03 AM.
 
Old 06-30-2005, 03:12 PM   #9
FlamingBee
Member
 
Registered: Mar 2005
Distribution: Mandrake 10.2
Posts: 35

Original Poster
Rep: Reputation: 15
Sorry about the lethargic response, but my NTL BroadBand is broken, so i've had to resort to finding a free 56k provider :/ Anyway, I have tested what you said by adding:

//omoikane/phobos /phobos smbfs uid=user,gid=user,username=will

(Note: My windows machine just has the one account, will, and that has no password)

into fstab. When the machine starts up it comes up with an error on the startup screen thing saying something along the lines of "mounting smb filesystem: Connection to omoikane failed" (the error message is slightly longer than that but it passes very quickly and I don't know where the log of the initialisation is stored).

When I click on "Computer" on my desktop, i can see my floppy drives, cdrom drive, phobos, filesystem, network. Phobos is the one i'm interested (that is the network drive). When i click on it I get the error message:

Mount Error
mount: Only root can mount //omoikane/phobos on /phobos

I hope this is enough info for you. Thanks for the patience and support thus far guys.
 
Old 06-30-2005, 03:30 PM   #10
stefan_nicolau
Member
 
Registered: Jun 2005
Location: Canada
Distribution: Debian Etch/Sid, Ubuntu
Posts: 529

Rep: Reputation: 32
Can you access the share from another Windows computer? I thought Windows wouldn't let you access shares if you don't have a password...
Is your Linux account named 'user', group 'user'?

Quote:
mount: Only root can mount //omoikane/phobos on /phobos
You could add 'user' to the mount options to allow anyone to mount the share. Note that user implies nosuid, noexec and nodev
 
Old 07-01-2005, 03:23 AM   #11
FlamingBee
Member
 
Registered: Mar 2005
Distribution: Mandrake 10.2
Posts: 35

Original Poster
Rep: Reputation: 15
Yes, the share is accessible from all other windows machines on the network. And my Linux account is named 'user', but I don't remember ever having put a group in... How would I find out what my group is?

Added user to the options, and now I get different error messages. I get either:

Cannot mount on /phobos: Operation not Permitted
smbmnt failed: 1

or, using the other entry in fstab,

SMB Connection failed.

Hope we can resolve this issue soon, it's driving me up the wall.

Btw, what are nosuid,noexec and nodev.
 
Old 07-01-2005, 03:44 AM   #12
stefan_nicolau
Member
 
Registered: Jun 2005
Location: Canada
Distribution: Debian Etch/Sid, Ubuntu
Posts: 529

Rep: Reputation: 32
Quote:
Yes, the share is accessible from all other windows machines on the network. And my Linux account is named 'user', but I don't remember ever having put a group in... How would I find out what my group is?
use the id command, and look for gid= in the output

Quote:
Added user to the options, and now I get different error messages. I get either:

Cannot mount on /phobos: Operation not Permitted
smbmnt failed: 1
does /phobos exist? can you write to it? Try mounting the filesystem as root to see if that works.

Quote:
Btw, what are nosuid,noexec and nodev.
nosuid: the suid bit on executables will not be honored
noexec: no file will be executed from this mount
nodev: no device file on this mount will work
These are used to prevent malicious users from mounting filesystems with malicious things on them (like suid shells, exploit code, world-writable block devices, etc.)
A user could create a floppy at home and put a suid shell on it. He could then mount the floppy on a work computer to get root access. This is why the work computer must refuse to honor the suid bit.
 
Old 07-01-2005, 02:11 PM   #13
FlamingBee
Member
 
Registered: Mar 2005
Distribution: Mandrake 10.2
Posts: 35

Original Poster
Rep: Reputation: 15
Right, using "id" i've found my uid=user and gid=user. /phobos definately exists, I can write to it, and i can mount the netwrok drive to it from console by (as root) using:

mount -t smbfs //windowspc/share /mount

where the name of the windowsPC is omoikane and the share is phobos, and it is being mounted to /phobos

On starting up the machine, if I press "esc" i can see a verbose version of the startup. In this i can see when it trys to mount the networked drive using samba, but it comes up with the error message:

Mounting SMB Filesystem
5167 Connection to Omoikane Failed
SMB connection failed

When I click on the "Computer" icon on the desktop, then double click on the "phobos" filesystem icon I still get the error message:

Cannot mount on /phobos: Operation not Permitted
smbmnt failed: 1

I have no idea why it does this. Is there a way I can make a custom-scrip that opens a command line, logs in as root, executes the commands and then closes when I run it? (asking me for the root password, obviously). This way i just run this when the machine has started up, and i can then use the network drives.

Thanks for the help this far, and for being so patient with me, it's much appreciated.
 
Old 07-01-2005, 05:21 PM   #14
stefan_nicolau
Member
 
Registered: Jun 2005
Location: Canada
Distribution: Debian Etch/Sid, Ubuntu
Posts: 529

Rep: Reputation: 32
Quote:
Is there a way I can make a custom-scrip that opens a command line, logs in as root, executes the commands and then closes when I run it? (asking me for the root password, obviously). This way i just run this when the machine has started up, and i can then use the network drives.
If it won't work otherwise... You should create a desktop link to the command: use gskuexec (gnome) or, for kde: right-click on the desktop>new>link>to application>Application>advanced>Run as:root and, for the command write 'mount -t smbfs //windowspc/share /mount' or 'mount /phobos'
 
Old 07-02-2005, 04:38 AM   #15
FlamingBee
Member
 
Registered: Mar 2005
Distribution: Mandrake 10.2
Posts: 35

Original Poster
Rep: Reputation: 15
Well, i'm fairly certain that adding entries into fstab won't work (looking over my system, i think the reason is that my wireless network card doesn't startup until after everything else, so fstab cannot connect properly). As for creating this link, how do I do it? I am using Mandrake 10.2 with Gnome desktop. Having searched for gskuexec on the internet, and typing it in command terminal, I have found nothing on it. If you could please guide me through the process of creating this link it would be much appreciated.
 
  


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
Trouble mounting a Windows share lowpro2k3 Slackware 2 10-17-2005 04:38 AM
Newbie Question - Auto mounting of server share file dodjie60 Linux - Networking 15 09-12-2005 09:34 AM
Auto mounting Linux smb share on Windows at startup neranjana Linux - Networking 1 07-02-2004 06:56 PM
auto mount windows share bloodhound1600 Linux - Networking 1 11-26-2002 04:16 AM
mounting a windows network share? graystarr Linux - Networking 2 11-09-2002 05:57 PM


All times are GMT -5. The time now is 11:15 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration