How do I "Map a network Drive" in Linux? [SOLVED]

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
salguod

How do I "Map a network Drive" in Linux? [SOLVED]

Post by salguod »

This might be better for the newbie forum, but it's a specific networking question.

I'm new to Linux, running Mint 15 Cinnamon on my older HP laptop. I connect to my router via wireless.

I have a WD MyBook Live NAS connected to the router as our family's primary file storage. It is mapped as Z: on the 2 Windows 7 PCs, as I did on my laptop when it ran Vista. Connecting to it now that I'm running Mint is confusing to me, however.

In Windows, once I mapped the network drive I was able to access it from any program. In Mint, I've created shortcuts to the folders I use in the 'Files' application, but when browsing the web in Chrome I cannot 'see' these shortcuts and, say, attach a file to an email in Gmail from the NAS. I can only access the local drive.

I've tried researching this and I see lots of references to 'Samba' and 'Mounting' and other processes, but I have no idea what those are or what they mean. I've not found a post or website that doesn't assume I know all the terms.

I simply want to be able to access the files my NAS easily from any application. How do I do that?

Thanks
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
karlchen
Level 23
Level 23
Posts: 18238
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: How do I "Map a network Drive" in Linux?

Post by karlchen »

Hello, salguod.

I hope that the answer at the bottom will be what you are looking for, i.e. the steps to using your NAS drive which has been attached to your local network router: [url=http://askubuntu.com/questions/207317/mount-remotely-mybook-live-network-drive]mount remotely mybook live network drive[/url]

Kind regards,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 792 days now.
Lifeline
salguod

Re: How do I "Map a network Drive" in Linux?

Post by salguod »

Nope, doesn't really help. It's about connecting to the NAS over the internet when away from the local network. My NAS is in the same room, on my home network, I just want to be able to access files on it in all applications.

I see the terms 'mount' and 'samba' (and a few other terminal commands or abbreviations) thrown around in discussions of networking, but I'm not exactly sure what they mean. I googled 'what is mount' and [url=http://linux.about.com/od/commands/l/blcmdl8_mount.htm]found[/url] that essentially it means 'connect', right? Linux doesn't use drive letters, so when my NAS is 'mounted' it just appears in the folder tree, I guess.

So, why can't I 'see' my NAS once 'mounted' when trying to attach a file to an email or upload an attachment here in Chrome? I also noticed that my 'mounted' drive isn't mounted at log in, I have to open 'Files' and click on one of the bookmarks I created.

I also Googled 'what is samba' and found [url=http://www.samba.org/samba/what_is_samba.html]this page[/url] which seems to indicate that it's software to help non-windows computers communicate with windows resources. I would guess I don't need to understand it since my NAS isn't a Windows device, right?
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: How do I "Map a network Drive" in Linux?

Post by altair4 »

Unfortunately the link that karlchen posted is relevant to your situation - at least within the original question in that link - where the user mounted the nas share locally though a cifs mount. Here's the problem:

When you mount the NAS through Nemo or "Connect to Server" it mounts the share here:
/run/user/your-user-name/gvfs/smb-share:server=nas-name,share=share-name
If you bookmark a launcher in nemo that will mount the nas share and open up say ... gedit the launcher appears in the Open Files dialog box. If the share is not currently mounted clicking on the bookmark will access and mount the share and you are good to go. But if you open up Firefox the bookmark disappears. Gedit is gvfs compliant whereas Firefox is not and gvfs is in control of this process.

The closest you are going to get I think to making it work using this method is to:

** Open Nemo and make sure the share is mounted.
** Create a bookmark to /run/user/your-user-name/gvfs
** Then when you are in your browser the "gvfs" bookmark should show up.

However, there is also a great probability that when you try to access the gvfs bookmark in the browser the process will stall. This whole thing worked a lot better when the gvfs mount point was within the users home directory but it was changed because developers like to change things until they break.

The cifs mount method has the advantage of bypassing the gvfs process entirely but it's more complicated to set up and you are basically automounting the share so make sure the NAS is turned on first. Try bookmarking the gvfs folder first and see if it works for you.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
salguod

Re: How do I "Map a network Drive" in Linux?

Post by salguod »

Reading your reply, which I'm certain has lots of good info in it, is how I've felt reading links I've found. I feel like I'm trying to read another language. I feel as though I'm pretty computer literate, but I have almost no idea what you're talking about.

cifs, Nemo, gvfs, gedit, launcher - what are all of these things? I don't mean to be difficult, but I've never heard of any of these before (I thought Nemo was a little fish with a bum fin :P). I did try browsing to the path you listed in Chrome from the 'Upload attachment' link here and I was able to find it. That's good, but it is buried quite a ways down in an obscure path. It'd be useful if the bookmarks created in the file browser were visible when browsing folders in other applications.

When I switched to linux, I knew there would be a learning curve and that I don't mind, but on this topic it seems there are so many layers of information and so many things to learn for what in Windows was a very simple and direct process - open a file browser, browse to the network drive, right click and select 'map network drive', click 'reconnect at login', done.
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: How do I "Map a network Drive" in Linux?

Post by altair4 »

Nemo is the name of the file manager in Cinnamon.
I did try browsing to the path you listed in Chrome from the 'Upload attachment' link here and I was able to find it. That's good, but it is buried quite a ways down in an obscure path. It'd be useful if the bookmarks created in the file browser were visible when browsing folders in other applications.
Two different kinds of bookmarks: One is a launcher that will actually do the mounting of the remote share. That may or may not appear in a given application depending on how the application was built. The other is a link to the mount point itself - that should be visible to every application although it still may not be accessible to a given application.

Run the following command:

Code: Select all

nemo /run/user/$USER/gvfs
The file manager will open up to the gvfs mount point parent folder. When that happens select Bookmark > Add bookmark. It should show up on the left side of nemo and all your other applications. But it's a mount point not something what will actually mount the remote share.

If you want something that bypasses all of this then you neeed to go old school and mount it via the terminal or fstab.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
salguod

Re: How do I "Map a network Drive" in Linux?

Post by salguod »

It's making more sense. Here's what I want, and I'm not afraid to slog through some things to get there. I'll just need some hand holding :P

I'd like the public folder of my NAS to show up in my folder tree automatically at boot / login and I'd like it to be available in any application when I try to open or save a file. Basically, the functional equivalent to mapping a drive in Windows. All my files are stored on the NAS and I'd like to continue to store them there without having to go through gyrations every time.

Can I get there? If so, how?

BTW - Thanks for your patience with my frustration with this. I didn't imagine that something that was so simple in Windows would be so difficult in Linux.
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: How do I "Map a network Drive" in Linux?

Post by altair4 »

Since you are ignoring my posts you will likely ignore this one as well but if you now want to automount this network share at login time and you want to use the method I've described above to access it then I would suggest Gigolo: Using Gigolo to Mount Remote Samba Shares: http://forums.linuxmint.com/viewtopic.php?f=42&t=52144

If none of that suits you then you will have to do it the old way:

Install the following package:

Code: Select all

sudo apt-get install cifs-utils
Create a mount point in your home directory ... let's call it NAS:

Code: Select all

mkdir /home/salguod/NAS
Edit fstab as root:

Code: Select all

gksu gedit /etc/fstab
Add the following line to the end of fstab if you do not require authentication:

Code: Select all

//192.168.0.111/Share-Name /home/salguod/NAS cifs guest,uid=1000,nounix,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
Or this one if then nas requires credentials:

Code: Select all

//192.168.0.111/Share-Name /home/salguod/NAS cifs username=salgoud,password=yournaspassword,uid=1000,nounix,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
Change 192.168.0.111, Share-Nmae, salguod, and yournaspassword to the correct ip address, nas share name, username, and nas password that the nas requires.

Notes:
*** The gigolo method has an advantage here since it will attempt to access the share forever whereas the fstab method might fail if the nas isn't accepting any calls when the desktop boots.

*** You will likely have to go through many iterations of the fstab line depending on how much effort the maker of the NAS had made in making this difficult to mount.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
salguod

Re: How do I "Map a network Drive" in Linux?

Post by salguod »

altair4 wrote:Since you are ignoring my posts you will likely ignore this one as well ...
My apologies, I didn't intend to ignore it. I read it and interpreted it as a work around, with limitations and something that may not work in all applications. So I didn't try it since I wanted something persistant, present at login and reliable in all applications, like I had in Windows. It didn't sound like your earlier post would do that, so I clarified what I was after.

I'm reading up on Gigolo at that other post, thanks.
salguod

Re: How do I "Map a network Drive" in Linux?

Post by salguod »

Well, it looks like Gigolo should work, but it's not. I believe I have it set up as described, but it's not mounting the drives. I get no error messages or notifications, it just isn't mounted. I can run one of my shortcuts in Nemo and it mounts just fine.

I created the shortcut to gvfs and that works fine, once the NAS is mounted.

I have some other issues:

- When I click on 'Network' in Nemo, I rarely see either NAS (I have two). I occassionally see my data NAS, but have never seen my backup listed.
- Once the data NAS was visible, I created shortcuts in Nemo and those work reliably to mount the drive and show the folder linked, regardless of whether I can 'see' the NAS under 'network' in Nemo.
- Once mounted, I cannot reliably browse to the same folder repeatedly. For example, I'm trying to post a CL ad for my camper. I upload image #1 by browsing to the NAS through the linked gvfs folder. When I try to do a second picture, I can get to the folder on the NAS but it never displays the files. Same thing happens in FF or Chrome. Restarting the browser or logging off and back in does not fix it. In fact, after a browser restart or logging back in, it freezes one level up in the tree from last time. A reboot will fix it, but only for one file than I'm frozen again. I can browse other folders in the NAS, but not that one. I can see the images in that folder in Nemo.
- It seems to make no difference if I'm plugged into the router or connected via wifi.

I'm using the wireless built into the media gateway from my cable company (WOW). I'm tempted to think it's their router causing trouble, but I only see connection issues in Mint, the two Win7 machines have no issues.

I need to create a new thread for this issue, but I wanted to followup with where I am.
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: How do I "Map a network Drive" in Linux?

Post by altair4 »

Gigolo never fails to mount - thus the name - as long as it can find the host. Most likely it's due to something outside it's control like this:
When I click on 'Network' in Nemo, I rarely see either NAS (I have two). I occassionally see my data NAS, but have never seen my backup listed.
If these two NAS devices are acting like Windows machines you can go through the [url=http://forums.linuxmint.com/viewtopic.php?f=42&t=88146&start=0]Samba Checklist[/url].
You might want to see if these devices are designed to work with apple by pinging to them this way:

Code: Select all

ping nasname.local
Or a real smb connection:

Code: Select all

nemo smb://nasname.local/sharename
Don't forget the ".local" at the end.

If it responds then you can use the "Connect to Server" option in Gigolo to have them automount at login using the mDNS qualified hostname ( with the .local at the end ) .

As far as things like Firefox stalling when you try to access the gvfs folder that's the bug I told you above concerning this new gvfs rewrite that's causing so much grief. The fstab mount circumvents this issue but it's just not as elegant a solution as gvfs used to be.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
salguod

Re: How do I "Map a network Drive" in Linux?

Post by salguod »

OK, I ran through the Samba checklist and everything looked fine. I was able to ping both drives (BTW - is the ping command supposed to keep running until you close terminal window?) and open them in nemo using the command you provided. The ping response times for the backup NAS were longer, and occasionally very long (30-140). I'm not sure what that means, but it doesn't seem to matter.

So I removed the bookmark I had created in Gigolo and recreated them and now they work fine. Not sure if I had something wrong last time or if the new smb path made the difference, but it works now.

Sounds like I'll continue to have issues in some programs, however, due to that bug, right? If I understand right, using your 'old way' above using fstab, that would fix it but it might not be as reliable to mount at login, correct?

Thanks for your help and patience with my ignorance of Linux terminology.

EDIT: It looks like the bug is not longer present either, I was able to test it out on Craigslist where I was able to upload several images from my NAS. Maybe it won't work every time, but it's definitely better.
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: How do I "Map a network Drive" in Linux? [SOLVED]

Post by altair4 »

Sounds like I'll continue to have issues in some programs, however, due to that bug, right?
You will until an adult professional developer over in Gnome-landia is found and persuaded to fix it. My hope is that it's all fixed by the time the next LTS version of Ubuntu/Mint is released.
If I understand right, using your 'old way' above using fstab, that would fix it but it might not be as reliable to mount at login, correct?
The fstab way has 2 major impediments and we'll take your nas as an example:

*** When the Mint machine boots it may execute fstab before it's own network connection is started so the line accessing the nas share fails. It never retries it. There's a relatively easy fix ( workaround ) to that.

*** You may not have your NAS running 24/7 so when fstab is executed when you boot into Mint and if your nas isn't there then you are out of luck.
You could alter the fstab line and add a couple of options that will have all the required mount parameters but prevent it from auto mounting. Then you would start the NAS and mount it's share will a simple mount command but that means opening up a terminal to issue that command.

Ironically and what makes the problem with gvfs so painful is that Gigolo will fix both of these shortcomings by polling the network forever until the darn nas is available to mount.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
chris2kari

Re: How do I "Map a network Drive" in Linux? [SOLVED]

Post by chris2kari »

salguod wrote:This might be better for the newbie forum, but it's a specific networking question.

I'm new to Linux, running Mint 15 Cinnamon on my older HP laptop. I connect to my router via wireless.

I have a WD MyBook Live NAS connected to the router as our family's primary file storage. It is mapped as Z: on the 2 Windows 7 PCs, as I did on my laptop when it ran Vista. Connecting to it now that I'm running Mint is confusing to me, however.

In Windows, once I mapped the network drive I was able to access it from any program. In Mint, I've created shortcuts to the folders I use in the 'Files' application, but when browsing the web in Chrome I cannot 'see' these shortcuts and, say, attach a file to an email in Gmail from the NAS. I can only access the local drive.

I've tried researching this and I see lots of references to 'Samba' and 'Mounting' and other processes, but I have no idea what those are or what they mean. I've not found a post or website that doesn't assume I know all the terms.

I simply want to be able to access the files my NAS easily from any application. How do I do that?

Thanks
1) KDE supports browsing network shares natively.
What that means to you is once shares are mounted they can be browsed by any application program without problem.
I recommend switching to Linux Mint KDE or Kubuntu.

2) In KDE there is a easy GUI application that will let you browse & mount shares at login called 'smb4k'.

Problem non existant.

In the GTK/Gnome world you have to waste your life typing arcane commands into terminal trying desperately to get the same functionality.
Yes, I am aware of 'gigolo' but due to the fundamental design flaws of GTK/Gnome (GVFS/GIO) it will not allow the ease of use and transparency expected.
Mark my words.

Chris
salguod

Re: How do I "Map a network Drive" in Linux? [SOLVED]

Post by salguod »

Interesting. As I understand, a switch to KDE would require reinstalling Mint, or at least that's the prefered way to do it. Am I right?
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: How do I "Map a network Drive" in Linux? [SOLVED]

Post by altair4 »

chris2kari wrote: 1) KDE supports browsing network shares natively.
What that means to you is once shares are mounted they can be browsed by any application program without problem.
I recommend switching to Linux Mint KDE or Kubuntu.
I installed Mint15 KDE recently on a test box but I'm not a KDE user any longer so maybe it's one of those multitude of switches I'm supposed to know how to set to make this work.

If I go to dolphin and access a remote share my assumption is that it's mounted somewhere. Could you tell me:

*1* Exactly where is that mount point located? Can't find it for the life of me - it's almost as if dolphin is using smbclient to access the share.

*2* When I open up Firefox and do a "Save As" there is no listing for the share I just accessed in Dolphin nor is there a mechanism to access any remote share. If I knew the answer to *1* I could figure out *2*.

*3* Are you using smb4K to circumvent Dolphin so that a real mount point is created giving your non-compliant applications something to access?

In Gnomelandia when Nautilus or any other file manager accesses a remote share it creates an actual mount point automatically and until this new buggy gvfs was implemented all a user had to do was access that mount point ( ~/.gvfs ) for non-compliant applications.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
chris2kari

Re: How do I "Map a network Drive" in Linux? [SOLVED]

Post by chris2kari »

salguod wrote:Interesting. As I understand, a switch to KDE would require reinstalling Mint, or at least that's the prefered way to do it. Am I right?
I have a Western Digital NAS here also, but this applies to any network share.

In case I was unclear, in the Cinnamon or MATE (Gnome) desktop you can connect to & interact with network shares from within Caja/Nemo file browser, their GVFS/GIO impelentation works up to that point.
You can also use a nice GUI progam called Gigolo in Mint MATE/Cinnamon to easily remount a share (viewable in Nemo/Caja file manager).
But if you wish to access your share from within any other program outside of the file manager you're not going to have any luck.
A few programs are written specifically to work with GVFS, very few.

In KDE you can connect to & interact with network shares from within Dolphin file browser using there KIO implentation.
You can also use a nice GUI progam called smb4k to properly mount & interact with your shares.
If you wish to access your share from within any other program this will work as expected in KDE.

Yes, unfortunately it means downloading the ISO for KDE, putting it on a USB stick using :

Code: Select all

sudo dd if=/path/to/*.iso of=/dev/sd* bs=4M && sync
or burn it to a DVD.

Regards,
Chris
Last edited by chris2kari on Tue Sep 10, 2013 10:24 am, edited 1 time in total.
chris2kari

Re: How do I "Map a network Drive" in Linux? [SOLVED]

Post by chris2kari »

altair4 wrote:
chris2kari wrote: 1) KDE supports browsing network shares natively.
What that means to you is once shares are mounted they can be browsed by any application program without problem.
I recommend switching to Linux Mint KDE or Kubuntu.
I installed Mint15 KDE recently on a test box but I'm not a KDE user any longer so maybe it's one of those multitude of switches I'm supposed to know how to set to make this work.

If I go to dolphin and access a remote share my assumption is that it's mounted somewhere. Could you tell me:

*1* Exactly where is that mount point located? Can't find it for the life of me - it's almost as if dolphin is using smbclient to access the share.

*2* When I open up Firefox and do a "Save As" there is no listing for the share I just accessed in Dolphin nor is there a mechanism to access any remote share. If I knew the answer to *1* I could figure out *2*.

*3* Are you using smb4K to circumvent Dolphin so that a real mount point is created giving your non-compliant applications something to access?

In Gnomelandia when Nautilus or any other file manager accesses a remote share it creates an actual mount point automatically and until this new buggy gvfs was implemented all a user had to do was access that mount point ( ~/.gvfs ) for non-compliant applications.
Both Gnome 3.x & KDE 4.x have a file browser that can show & connect to network shares.
Gnome mounts the share using GVFS & the vast majority of programs cannot see it - they have to be _specifically_ written to support GVFS. eg In the "File Open/Save" dialog box you cannot see the share.
Gigolo gives you a convenient way to remount multiple shares but they cannot be seen by the majoroity of programs.
There is no solution to this. Its a limitation of GVFS.

KDE 4 uses a different & in this case far better tech compared to Gnome 3.
A share can be quickly viewed in Dolphin as you found _but_ a 'real' mount is needed for other programs to use the share.
The easiest way to do this is use smb4k to create a mount for your share.
The default location is in the users directory in a folder called "smb4k". You don't need to browse this folder!

A properly mounted share using smb4k will show up in the 'Places' section of Dolphin & the share will also be visible in the 'File Open/Save' dialog of any other program.

Regards,
Chris
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: How do I "Map a network Drive" in Linux? [SOLVED]

Post by altair4 »

KDE 4 uses a different & in this case far better tech compared to Gnome 3.
A share can be quickly viewed in Dolphin as you found _but_ a 'real' mount is needed for other programs to use the share.
The easiest way to do this is use smb4k to create a mount for your share.
The default location is in the users directory in a folder called "smb4k". You don't need to browse this folder!
So there is no native way for KDE ( i.e., Dolphin ) to mount a remote share making it available to all programs. Smb4K or some other mechanism is required to create an actual mount point for that purpose.

Thanks for the explanation. I guess it's been so long since I used KDE I forgot how it handles this sort of thing.

@salgoud, I've got a suggestion based on something I just recently dusted off that you might be interested in - assuming you are not going to go down the KDE path: autofs. It's not a share browser it's a share mounter and it might just fit your requirement for your NAS since it's something you always access.

It has a real mount point so all your apps can use it.
It's doesn't use gvfs so you don't have to wait for this current ( post LTS ) buggy version to get fixed.
It's not in fstab so you avoid any possible timing problems with the network starting.
The thing will even shut itself down when the share is not in use.
It works by creating a connection on the fly when you access the mount point.

If you are interested let me know.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
salguod

Re: How do I "Map a network Drive" in Linux? [SOLVED]

Post by salguod »

I'm not opposed to re-installing with KDE. Frankly, it sounds as if it'll better handle my NAS, and since I save everything on the NAS I need to access it a lot. I wonder if it might play nicer with my nvidia graphics card which I haven't yet found a decent driver for (see [url=http://forums.linuxmint.com/viewtopic.php?f=46&t=143922]this thread[/url])

If your autofs solution will get me ther too, I'm all ears.

Oh, and this thread is validating my choice of Mint over other Linux flavors simply based on the presence of this community. I knew that I was going to face a learning curve and wanted to know there were folks willing to help me through it. Thanks all.
Locked

Return to “Networking”