LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Mount shared folder with fstab - need help (https://www.linuxquestions.org/questions/linux-networking-3/mount-shared-folder-with-fstab-need-help-519906/)

robertpolson 01-16-2007 02:52 PM

Mount shared folder with fstab - need help
 
My problem right now is that fstab mounts shared windows folders before the Wireless connection is established.


Is there any way to create a delay for these shared folders to mount? Or tell fstab to wait for network connection?

That creates a problem for when there are other users who want to access shared folders and need sudo password to perform "mount -a" operation.

Is there any way to fix this ?

Also, what do the Zeros "0 0" mean at the end of the lines like this one:

//192.168.1.10/windowshare /mnt/winshare smbfs credentials=/root/.smbcredentials,dmask=777,fmask=777 0 0

acid_kewpie 01-16-2007 03:48 PM

i would *VERY* strongly suggest you look at autofs, which mounts the filesystems on access, not on boot. especially with network dependent file systems, when you have network issues, i.e. you trip over a cable, your boxes can often hang trying to read from a drive mapped over a LAN. if you use autofs it'll unmount after periods of inactivity so things like that can't happen either.

robertpolson 01-16-2007 04:11 PM

Ok, thank you. I will Google and research on how to use it.

I will post back.

robertpolson 01-16-2007 07:24 PM

So far, reading the guides I am confused on how to mount the shared folders?

I currently have this in my fstab

//192.168.1.7/F /media/battlestation/F smbfs dmask=777,fmask=777 0 0

where do I add this line into autofs ?

auto.master or auto.net ??

Being A Linux noob and just installing it, I am confused looking at this guide:

http://freespace.sourceforge.net/gui...to/autofs.html

or this

http://gentoo-wiki.com/HOWTO_Auto_mo...ystems_(AUTOFS)

Help.

P.S. what is automount command ? Can it be used instead? What is the difference between the two ?

acid_kewpie 01-17-2007 09:40 AM

check the samba example twoards the bottom of this page. http://www.linux-consulting.com/Amd_.../autofs-5.html

robertpolson 01-17-2007 12:04 PM

Still looks confusing.

All I want to know is where do I put in this line to auto mount:

//192.168.1.7/F /media/battlestation/F smbfs dmask=777,fmask=777 0 0

?

acid_kewpie 01-17-2007 12:27 PM

you don't put it anywhere. that's an fstab line, not an autofs line. hence me providng link to an example.

robertpolson 01-17-2007 01:52 PM

Please clarify this, as I am a total noob in all of this.

As I understand:

auto.master - contains the mount points to where the directory will be mounted. Say for example:

/media/battlestation/F auto.battle



Where

auto.battle must contain what in order to mount 192.168.1.7/F


??

acid_kewpie 01-17-2007 02:00 PM

auto.master defines which directories are to be managed by autofs, and which file to use to refernce potential mount points within that directory. so *IF* you wanted to access /media/battlestation/F then autofs.master defines the fact that you wish to manage to locations underneath /media/battlestation, yes. so as in the example link i gave you, you'd need an equivalent entry like "F -fstype=smbfs,dmask=etc... ://battlestation/F"

robertpolson 01-17-2007 02:13 PM

So in auto.master I will add this

/media/battlestation/ /etc/auto.battle

meaning that autofs will manage this directory.

[Where inside /media/battlestation/ there is an "F" folder]





and in auto.battle

I will add this line:


F -fstype=smbfs,dmask=777.fmask=777 ://192.168.1.7/F



Is this correct ?

robertpolson 01-18-2007 05:03 PM

The above configuration did not help. Doins as I wrote above does not mount the shared folders.

Anyone, any help ?

kgd35s4wbxzrn08 01-18-2007 05:07 PM

Thank you very much for your helpful replies acid_kewpie.

robertpolson 01-18-2007 10:08 PM

What happens now is that it looks like

auto.master is running auto.battle script fine [auto.battle being the one I created myself)

What I cannot understand is what to put into the auto.battle file so that it will mount my samba share ?

Is this exact command the correct one for me?

Quote:

F -fstype=smbfs,dmask=777.fmask=777 ://192.168.1.7/F
and in the
Quote:

auto.master
should I have

this:

Quote:

/media/battlestation/F auto.battle
or this:

Quote:

/media/battlestation/ auto.battle

acid_kewpie 01-19-2007 01:41 AM

the auto,.battle entry looks fine, from what i'm aware of. the master would be the latter of your two options.

robertpolson 01-19-2007 07:00 PM

Ok, so far this seems to work but only for me - the user name that I use to log in, the one that was created when I initially installed Kubuntu.

The problem that I have with this setup is that other users cannot access these shared folders.

Only after I access these shared folders via my account, they appear to be working if I log out and log in into another account/

Does autfos also works and starts automatically for other users? Is there anything else I need to configure?

acid_kewpie 01-20-2007 02:30 AM

i assume you would need to reference a smb credentials file to define the low level acount details to connect with.

robertpolson 01-20-2007 08:58 AM

Sorry, but being a linux noob coming from windows, I have no idea how to do that. I barely have an idea of what you mean about smb credentials at the moment.

Please explain in a bit more details.

acid_kewpie 01-20-2007 09:05 AM

well you can just do a "username=" and "password=" in line with the existing mask options you have, but a credentials file is used to hide those details from other users, as all users can read most files in /etc if they wish. if you add an option like "credentials=/home/youruser/samba_creds" and crate that file with "username=x" and "password=y" on seperate lines, and then change the rights to mode 600 (so only you can read and write to it) then you keep securirty. if your not fussed about that, then just hardcode the username and password directly in your autofs files.

robertpolson 01-21-2007 12:13 PM

Does auto.master AKA - autofs starts its operation for SUDO user only or for all other users too?

I mean why does it need "username=" and "password=" ? Aren't these to access the actual shared drive? Because the problem is that autofs does not mount the shared drives for other users automatically, unless I first log into my sudo account and run autofs there, then log out and log back in into another user and then the folders will work.

Other users can browse via samba no problem, but autofs - it seems as if it does not start automatically for them.

I will try what you have writeen above and will psot back.

acid_kewpie 01-21-2007 01:10 PM

autofs doesn't know, or care, about sudoers and such, it's totally outside of anythign like that. if autofs is configured to permit access according to its own config files, then that's kinda it. maybe i've misinterpreted your problem here, as the username and password are the credentials that are passed to the remote server, not used locally at all.

robertpolson 01-21-2007 02:38 PM

Apparently the problem even exists at my sudo account.

From my last working samba access I have created desktop shortcuts to the folders that were mounted last time autofs mounted them.

Now, I just logged in, my network is working but when accessing the folders, I get this:

"Could not enter folder /media.battlestation/G"

Only when I do this in the terminal:

"sudo /etc/init.d/autofs restart" I get access to the folders.


So the question is, does autofs automatically configured itself to run when the laptop boots?

Because according to this document:

http://gentoo-wiki.com/HOWTO_Auto_mo...nd_System_Boot

They have:

Startup and System Boot

After this is complete, start the AUTOFS daemon by issuing:

/etc/init.d/autofs start

If you wish to have this behavior on default startup, issue:

rc-update add autofs default



But

"rc-update add autofs default" is not for Kubuntu

robertpolson 01-26-2007 05:38 PM

[QUOTE=robertpolson;2068304]Ok, the problem has been solved.

1) Go and download Autofs synaptic or Adept for Kubuntu.

2) sudo gedit /etc/auto.master

or

kdesu kate /etc/auto.master

and

this is what I have there:


Quote:

# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
/media/battlestation /etc/auto.battle --timeout=60 --ghost
/media.... is all you need to care about as the rest is commented out.

Make sure to put something close to -60 as I tried -4 seconds and that created a problem that via wireless connection I could not access the folders. The -ghost makes a it so that the location of the folders is remembered, meaning you can access the files without autofs mounting the folders.

2)auto.battle is where you specify what you want to mount. (note that auto.battle is the an empty text file I have created myself)

Here is what is in mine:

Quote:

G -fstype=cifs,noperm,iocharset=utf8,guest,file_mode= 0777,dir_mode=0777 ://192.168.1.7/G
F -fstype=cifs,noperm,iocharset=utf8,guest,file_mode=0777,dir_mod e=0777 ://192.168.1.7/F
G -fstype=cifs,noperm,iocharset=utf8,guest,file_mode=0777,dir_mod e=0777 ://192.168.1.7/G
Note that the above uses cifs file system and 0777 gives full read and write access. Reason I use cifs instead of smbfs is because Amarok works with cifs better and with smbfs I would get collection scan errors. See official Amarok samba wiki.

You can also use smbfs, it would look like this:

Quote:

G -fstype=smbfs,noperm,iocharset=utf8,guest,fmode=777,dmode=777 ://192.168.1.7/G

Where noperm, will make it so that Linux will not need to change permission on files on windows box as it does nto exist there.

That is it, just also go to terminal and do this


Quote:

sudo /etc/init.d/autofs restart

Hope this helps to someone in the future.


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