Friday, April 6, 2012

CIFS Share Mount as non-root


Trying to run smbmount as a non-root I received the error:

mount.cifs: permission denied: no match for...

Option 1 - Permanent:


Set this up in fstab would be a permanent solution on every boot.
Add a line like this to your fstab file.

Open Share:

//server/path/to/share /mount/point cifs dir_mode=0775,guid=1000 0 0

Protected Share:

//server/path/to/share /mount/point cifs credentials=/root/.smbpass,dir_mode=0775,guid=1000 0 0

For a protected share, create the file /root/.smbpass Add these lines to the file.
username={username of server}
password={password}

 

Option 2 - Temporary:


For me, my laptop moves around in many server environments so I use a more flexible method that does not auto-mount on boot.

If using Ubuntu you can use the "Connect to Server" under "Places" but I prefer using the following command.  I find it is simpler and quicker.  Either method you choose, once connected you can create a bookmark in nautilus allowing easier re-mount by selecting the bookmark.  You only need to decide whether to permanently store the share password or ask for it on each mount.

Open or Protected Shared:

gvfs-mount smb://server/path/to/share

If the share is protected you will be asked for:
User [localuser]: {username of server}
Domain [WORKGROUP]: {server domain of user account}
Password: {password}

This will add the share and allow you to unmount it without using root.


Additional Information:


Shares goto ~/.gvfs by default but you can always map them to another area if needed.

No comments:

Post a Comment