LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-23-2007, 05:56 AM   #1
louisb
Member
 
Registered: Aug 2003
Posts: 199

Rep: Reputation: 15
Mounting a Network Drive


I'm new to Linux.

I have a Red Hat AS 4 Server and I'm trying to mount a network share on a Red Hat Linux 5 Server. I've successfully gotten network mount of a share working however, I can only mount the share when I log-on with the root userid.

What I want to do is mount the network drive available to any user that signs-on . I've placed the mount in "fstab" however, it doesn't work because the filesystem is mounted before networking devices are started. Which means that I get a mount error at systems startup because the network is not available.

So my question is how do I mount the network drive and may make the drive available to all of those that log-on?

Thanks
 
Old 07-23-2007, 07:09 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
the most elegant way would be to use autofs, not fstab, so that the device is mounted on access, not on boot. check /etc/auto.master and /etc/auto.net
 
Old 07-24-2007, 09:55 AM   #3
louisb
Member
 
Registered: Aug 2003
Posts: 199

Original Poster
Rep: Reputation: 15
That's just the answer that I've been looking for. Hoever, I do have a question.

How will users see the network drive under ther userid or will they? What I mean is under there "home" directory or will they have to go up one level to use it?

How to I make it available to them under there "home" directory? I'm currently reading about it on the internet to beter understand how it works and how to configure it to accomplish what I want.

Your information is what I've been looking for. I'm new to the Linux environment comming from Windows.

Thanks
 
Old 07-24-2007, 10:12 AM   #4
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
well a /home partition can live absolutely anywhere, there's nothing inherently special about it. if you mount a posix compliant file ssytem (ie.. a unix one like ext3 or nfs) then any local user with the same uid and or gid as a file on that new filesystem can use it, irrelevant of where it is etc... so as long as the user logged into the client machine has a uid and such like in line with the ownership of their own /home/user directory you're good to go. often ldap is used to centralize the user accounts as well as the users data for simplicity.
 
Old 07-24-2007, 11:09 AM   #5
louisb
Member
 
Registered: Aug 2003
Posts: 199

Original Poster
Rep: Reputation: 15
There's one part that I'm msssin here? When mounting a network file system ou must have a mount point/directory on the workstation. Since user home directories have the format of "/home/user". How do I make is available to the user community inf the format of '/home/user/network share" for each user?


Thanks
 
Old 07-24-2007, 12:27 PM   #6
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
so you don't want it to be the entire share, just a subdirectory? i would suggest using a symlink to map "/home/user/networkshare -> /var/networkshare/user" . this could be provided via a check and command in a central file, /etc/profile or similar...

[ -L "~/networkshare" ] || ln -sf /var/networkshare/$(whoami) ~/networkshare
 
Old 07-24-2007, 01:10 PM   #7
louisb
Member
 
Registered: Aug 2003
Posts: 199

Original Poster
Rep: Reputation: 15
That means then that I would have to peform the mounting of the network share first. Then apply a script in the "/etc/profile" that would apply the user name/home directory to the share. Am i on the right track?

Meaning that when a user does a "cd" or "clicks" on the sub-directory that contains there files the system would first mount the shared network drive and then allow the "cd" to take place.

Thanks
 
Old 07-24-2007, 02:44 PM   #8
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
well with autofs the mounting is automatic and implicit. if a user clicks on an icon for /home/user/networkshare then that links to /var/networkshare/user. if that is not currently mounted then it will be mounted automatically and maybe after a 1 to 2 second delay on the first use, it is mounted and everything carries on as normal. note that there's only one single mount done for all users on a single system. the /etc/profile thing is just a way to ensure that the structure you asked for is set up correctly. if you're in a gnome / kde world, you could do somethign else like put a script on the desktop which they double click to open the folder, which just directly uses /var/networkshare/$(whoami) with no constant checking for links. in theory the suggest above for the symlink would only ever be actually executed once, the first time they ever log in. and if they were to delete the link manually of course.

Last edited by acid_kewpie; 07-24-2007 at 02:46 PM.
 
Old 07-25-2007, 09:17 PM   #9
louisb
Member
 
Registered: Aug 2003
Posts: 199

Original Poster
Rep: Reputation: 15
I seem to having some problems getting autofs to work. Please find below a copy of my "auto.master" and "net.share" both ar located under "/etc"

"auto.master" content:
#
# $Id: auto.master,v 1.4 2005/01/04 14:36:54 raven Exp $
#
# 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).
#
/misc /etc/auto.misc
/net -hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master

/.autofs /etc/auto.misc --timeout 60

#Mount network shares

/home/users /etc/net.share --timeout 60

end of file

"net.share:
#Mount network shares

netshare -fstype=nfs,soft (IP ADDRESS=xxx.xxx.xx.x):/disk1/Shared_Directories

end of file

I've stopped and re-started the autofs with no issues. When I do a cd on "/home/users" I should see a directory but instead I see nothing. I have "users" as a sub-directory under "/home" i.e. "/home/users"

Can you tell what might mbe wrong. Are there any logs to help me determine what is wrong?


Thanks
 
Old 07-26-2007, 02:06 AM   #10
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
not that familiar with troubleshooting autofs to be honest. have you tried just using the standard auto.net (?) file for generic nfs mounts? can you reach the remove server at /net/ip.ad.dr.ess/disk1/Shared_Directories?
 
Old 07-26-2007, 08:01 AM   #11
louisb
Member
 
Registered: Aug 2003
Posts: 199

Original Poster
Rep: Reputation: 15
I can reach the network share via IP addres by doing a mount as root and I can also ping the server. I'm not familar with "auto.net".

The fact the I can perform the mount as root is a good indication that the network share is avaiable. Is that true?


Thanks
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mounting a network drive... tobiasw Linux - Networking 3 10-23-2006 01:30 AM
mounting drive over network spideywebsling Linux - Networking 7 07-20-2004 10:27 PM
mounting network drive viper52b Linux - Networking 2 03-10-2004 12:59 PM
mounting network drive Canadian_2k2 Linux - Networking 4 01-04-2004 11:58 PM
mounting a network drive... Sonny Linux - Security 6 01-24-2002 12:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:25 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