Page 1 of 12 12311 ... LastLast
Results 1 to 10 of 118

Thread: Map Windows Shares Permanently with GVFS

  1. #1
    Join Date
    Apr 2005
    Beans
    432
    Distro
    Ubuntu

    Arrow Map Windows Shares Permanently with GVFS

    Concept

    The file manager in MS Windows has a nice feature called "Map Network Drive". This allows you to permanently assign Samba shares to a drive letter which any program can access. It can be made persistent across reboots. This feature is tremendous when you have a Samba server on your network that has files you need to continuously access.

    Applicable Systems

    This guide will explain how to do the same using an up-to-date Ubuntu Intrepid or Jaunty. This guide will not work on Hardy unless this bugfix is backported to Hardy.

    Comparison to Other Methods

    There is an ages-old method which produces a similar result and involves editing /etc/fstab. I don't like this method for a number of reasons, such as the fact that it's difficult, it involves storing your Samba password in plain text, and it exposes a nasty bug that can cause your system to hang on shutdown.

    Procedure

    1. Select the "Network" option from the "Places" menu.

    2. Select the "Windows Network" icon.

    3. Select the workgroup that your share resides in.

    4. Select the PC on your network that contains the share you want to access. You will now see an authentication prompt. Enter the correct username and password. IMPORTANT: Make sure to select the radio button that is labled "Remember forever". This will permanently save your password in the GNOME keyring.

    6. Select the "Connect" option. You will now see a folder for each share that is available on the selected PC.

    8. Select the folder you want to access. You will now see a prompt regarding the keyring. Select the "Always Allow" option. The share is now temporarily mounted (will not survive a reboot) and your password is permanently saved and accessible in the GNOME keyring.

    9. The share should be visible in the "Places" menu on the left of the Nautilus file manager. Select the eject icon to the right of the share to unmount it.

    10. Now we will test out a command which will go into a script. Open the Terminal from the "Accessories" submenu in the "Applications" menu.

    11. Run this command in the Terminal while filling in the appropriate information within the <> symbols.
    Code:
    gvfs-mount smb://<pcname>/<sharename>
    Example:
    Code:
    gvfs-mount smb://desktop/sharedfolder
    The share should now be mounted again and will appear in the "Places" menu on the left side of the Nautilus file manager. Select the eject icon to the right of the share to unmount it.

    12. Now we will put that command in a script to be executed during startup. In the Terminal, run this command to create the script:
    Code:
    gedit ~/sharemount.sh
    If you'd like to change the path or the filename of the script, feel free to do so.

    13. Paste this into the GEdit window while filling in the appropriate information into the <> symbols.
    Code:
    #!/bin/sh
    gvfs-mount smb://<pcname>/<sharename>
    Example:
    Code:
    #!/bin/sh
    gvfs-mount smb://desktop/sharedfolder
    14. Make the script executable by running this command in the Terminal:
    Code:
    chmod +x ~/sharemount.sh
    15. Now let's add the script to GNOME startup. Choose the "Startup Applications" option from the "Preferences" submenu located in the "System" menu.

    16. Select the "Add" option. Type a name of your choice in the "Name" field, browse to the path of the script in the "Command" field, and optionally add a comment to the "Comment" field. Press the "Add" button to save your settings.

    17. Now log out and log back in or restart your PC. Check the "Places" menu and the shares should be automatically mounted.

    Usage Notes

    The shares are mounted using GVFS. From the GNOME GUI, shares are accessible via the "Places" menu in Nautilus and the smb:// path in the address bar. Command-line programs can access these shares via the ~/.gvfs path.

    Uninstallation

    If you'd like to remove these changes, follow the these two simple steps:

    1. Choose the "Startup Applications" option from the "Preferences" submenu located in the "System" menu. Select the sharemount.sh script and press the "Remove" button.

    2. Delete the script with the Terminal:
    Code:
    rm ~/sharemount.sh
    Community Additions

    Since the ~/.gvfs directory is a directory like any other, michaelzap presented the idea of using symbolic links to further improve the usefulness of all this. In particular you can work around particular applications such as Firefox that don't display network mounts in their file open/save dialog.
    Last edited by NTolerance; August 6th, 2010 at 02:40 PM.

  2. #2
    Join Date
    Apr 2005
    Beans
    432
    Distro
    Ubuntu

    Re: Map Windows Shares Permanently with GVFS

    Which topic title, keywords, tags, etc... do I need to get some interest in my awesome thread?

  3. #3
    Join Date
    Mar 2006
    Location
    Kitakyushu Japan
    Beans
    9,361
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Map Windows Shares Permanently with GVFS

    Quote Originally Posted by NTolerance View Post
    Which topic title, keywords, tags, etc... do I need to get some interest in my awesome thread?
    I actually didn't know this was possible. Nicely done. I'll link to it in my CIFS tutorial.

  4. #4
    Join Date
    May 2007
    Beans
    12

    Re: Map Windows Shares Permanently with GVFS

    I think this method will also store your password in plain text. Have a look in Applications -> Passwords and Encryption Keys. In the Passwords tab, your password description should be listed. If you look at the Properties of the key, you can show the password in plain text with a couple of clicks of the mouse! I only discovered this a few days ago...not impressed.

  5. #5
    Join Date
    Apr 2005
    Beans
    432
    Distro
    Ubuntu

    Re: Map Windows Shares Permanently with GVFS

    Quote Originally Posted by dmizer View Post
    I actually didn't know this was possible. Nicely done. I'll link to it in my CIFS tutorial.
    Thanks!

    Quote Originally Posted by Jorgo View Post
    I think this method will also store your password in plain text. Have a look in Applications -> Passwords and Encryption Keys. In the Passwords tab, your password description should be listed. If you look at the Properties of the key, you can show the password in plain text with a couple of clicks of the mouse! I only discovered this a few days ago...not impressed.
    The password is encrypted on the disk, but it can be displayed as text if you are properly authenticated/logged in to GNOME.

    From the GNOME wiki:
    GNOME Keyring is a place where passwords (and soon encryption keys) for a user are stored in an encrypted file. The user enters a global password when first accessed.
    By comparison, the password files that the fstab methods use are stored unencrypted in plain text on the disk.

  6. #6
    Join Date
    May 2009
    Beans
    11

    Re: Map Windows Shares Permanently with GVFS

    Thanks for that tutorial. It comes in very handy for me as I've been playing around with a D-LINK DNS-323 NAS the past couple of days.

  7. #7
    Join Date
    Jul 2008
    Beans
    68
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Map Windows Shares Permanently with GVFS

    Quote Originally Posted by NTolerance View Post
    Thanks!



    The password is encrypted on the disk, but it can be displayed as text if you are properly authenticated/logged in to GNOME.

    From the GNOME wiki:


    By comparison, the password files that the fstab methods use are stored unencrypted in plain text on the disk.
    Using the CIFS tutorial though, one would need root access to the machine to read the .smbcredentials file even though it's plain text, no?

    Cool tutorial nonetheless, I will look at playing with it; might be good for mounting shares for certain users only.

  8. #8
    Join Date
    May 2009
    Beans
    11

    Re: Map Windows Shares Permanently with GVFS

    Quick question: should a share that is mounted this way be manually unmounted before system shutdown, or will the OS take care of that automatically?

  9. #9
    Join Date
    Mar 2006
    Location
    Kitakyushu Japan
    Beans
    9,361
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Map Windows Shares Permanently with GVFS

    Quote Originally Posted by sloppyc View Post
    Using the CIFS tutorial though, one would need root access to the machine to read the .smbcredentials file even though it's plain text, no?
    Yes, but with this method even root (or anyone in sudoers) cannot view the password. Even though cifs and /etc/fstab still has advantages, this method is certainly more secure.

  10. #10
    Join Date
    Jul 2008
    Beans
    68
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Map Windows Shares Permanently with GVFS

    Ah, I see now.

Page 1 of 12 12311 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •