Mounting windows share with non-root users?

26,847

If the USER has to mount it, you can always use GVFS. Its the same as clicking, Places > Network > Server > Path and seeing that pretty icon in the Places folder, and your desktop.

Term: gvfs-mount smb://serverip/path

This will add it to the places menu, and allow you to unmount it without using root.

Drawbacks:

  • Shares goto ~/.gvfs by default, you can always map them to another area if needed. If you are a click based person this wont matter to you.
  • If there is a password on the share, there is no way to auto mount it. Must be done manually.

If these are fixed shares you create at the boot process, you can use fstab and CIFS.

Add a line like this to your fstab file.

Open Share:

//serverip/path /mnt/path cifs dir_mode=0775,guid=1000 0 0

Passworded share:

//serverip/path /mnt/path cifs credentials=/root/.smbpass,dir_mode=0775,guid=1000 0 0

For a passworded share, create a file /root/.smbpass Add lines like this to it...

username=<user>
password=<pass>
Share:
26,847

Related videos on Youtube

Mohit
Author by

Mohit

Updated on September 18, 2022

Comments

  • Mohit
    Mohit over 1 year

    I'm having some trouble mounting shares on 11.10. I've installed pyNeighborhood through which I can mount windows shares as root. I want to be able to mount them as non-root so that I can write to the shares. I did some googling and tried a few things, but none of it helped:

    sudo chmod 6755 /sbin/mount.cifs
    sudo chmod 6755 /bin/umount
    sudo chmod u+s /sbin/mount.cifs
    sudo chmod u+s /bin/umount
    

    Any ideas?

    Mounting gives this error:

    mount.cifs: permission denied: no match for /home/myUser/pyNeighborhood/WORKGROUP/myServer/myShare found in /etc/fstab
    
    • jelmer
      jelmer over 12 years
      What exactly doesn't work, what error does mount.cifs give?
    • Mohit
      Mohit over 12 years
      mount.cifs: permission denied: no match for /home/myUser/pyNeighborhood/WORKGROUP/myServer/myShare found in /etc/fstab
    • htorque
      htorque about 12 years
      This question appears to be abandoned as there hasn't been any activity for a longer period of time. I'm voting to close it for now. If by any reason you think this question is still viable or useful in anyways or that there is still a good chance it will be answered please flag it to a moderator or add a comment with the reasons why you want it reopened. Thanks!
    • tripleee
      tripleee about 11 years
      This is a security restriction in recent versions of Samba. See bugs.launchpad.net/ubuntu/+source/cifs-utils/+bug/657900
  • Mohit
    Mohit over 12 years
    gvfs-mount smb://myServer/myShare Error mounting location: Failed to mount Windows share
  • vkcaspervk
    vkcaspervk over 12 years
    Make sure you are using the IP, not the host name. =) If you still receive the error verify the windows box is sharing correctly.