Is there a step-by-step tutorial that instructs in detail how to smbmount a Samba share to be used by a non-root user on a Ubuntu 10.04 desktop?

Note: there are numerous threads on Google search dealing with this seemingly new problem. Instructions that used to work on Ubuntu 8.04 (or an older version of smbfs) no longer work.

I need to find something that's up to date and reproducible.


A very nice tool to easily mount your samba shares in your home folder is SMBNetFS. With this tool you can access your samba shares by nearly all applications simply through a mount point in your home.

How to use SMBnetFS:

  • Install the package through your package manager
  • cp /etc/smbnetfs.conf ~/.smb/smbnetfs.conf copy standard configuration
  • cp /etc/samba/smb.conf ~/.smb/smb.conf copy samba configuration
  • mkdir ~/sambashare or any other name for the mount point
  • smbnetfs ~/sambashare mount the shares to the mountpoint

Unfortunately there is only little documentation available. See man smbnetfs for options and go through the FAQ file in /usr/share/doc/smbnetfs.

|improve this answer|||||
  • +1 for the detailed steps. I hope this works with Eclipse, because with gvfs Eclipse definitely doesn't work. Do you happen to know how SMBnetFS is different from smbfs? – Android Eve Feb 1 '11 at 23:14
  • 2
    SMBNetFS uses fuse. Make sure users are in the fuse group. – Takkat Feb 1 '11 at 23:23
  • +1 again! Doesn't gfvs use FUSE as well? How is it different from what I already have prepackaged (gvfs) with my GNOME desktop? – Android Eve Feb 1 '11 at 23:38

When using gnome, you can simply type in the smb:// url into Nautilus. Normally gvfs-fuse and other gvfs packages should be installed, so that you can mount samba directly with the file browser. Additionally you should find all mounted stuff in your ~/.gvfs folder. This even works with other protocols and compressed files etc.

gvfs-mount smb://user@server/storage

I've tested it with eclipse and other tools and it works. gvfs-fuse must be installed.

|improve this answer|||||
  • Thanks but Eclipse won't work with this. I tried this already, that's why I was specifically asking about smbmount (a symbolic link to mount.cifs which is part of the smbfs package). – Android Eve Feb 1 '11 at 23:09
  • 2
    So eclipse can't access .gvfs in your home dir? As far as I know, every program should be able to do this. Correct me if I'm wrong. – matthias.lukaszek Feb 2 '11 at 9:23

man mount will help you determine what options you want. If the windows system will always be available. You can just add the mount to the /etc/fstab and it will be mounted. You can allow the user to mount and unmount the partition as required using the options user,noauto. To allow others to unmount it change user to users.

Autofs also supports on demand mounts using samba. The incantation depends on which directories you want mounted when. I've run it successfully in a development environment.

EDIT: If you need to do this for a lot of users, I suggest using autofs to do the mounting. This does not require changes to fstab. Obtaining credentials for the various users may be a problem. I use a directory structure in the form /net/$HOST/$USER for my mounts. Autofs is configured for the /net/$HOST portion of the mount and automatically mounts the directories under it as needed.

Particular mounting approaches depend on your needs. I have had cases where users needed their Desktop directory mounted on the server, although typical mounts are server based.

For large organization with lots of user it may make sense to move the directories to a Linux server and use Samba to share the files to Windows users. I haven't tried the reverse, but it may be possible.

|improve this answer|||||
  • This works, but you need root access to change fstab. Even if are root, note that it is quite impractical if you have to do it for a lot of users, each with a specific share to mount (as in a large organization where each user has a personal share in a centralized file server). – user46513 Feb 15 '12 at 13:11

I found this question while researching the magic I performed recently to do exactly this for one of my users. My workflow differs remarkably to the other answers. Do note, however, this is about the most simple case possible.

Assuming your username is ae and your home is /home/ae

1) Set up smbfs:
mkdir /home/ae/.smb

1a) If windows login credentials are needed, create and edit the file: /home/ae/.smb/smbnetfs.conf to have contents:

auth winuser "winpassword"

winuser is the user created on the Windows computer you wish to access. winpassword is that user's password to log in to Windows on that computer.

2) Create your mount point:
mkdir /home/ae/nethood

3) Execute the smbnetfs command:
smbnetfs /home/ae/nethood

Note the entire "network neighborhood" will show up under /home/ae/nethood with the workgroups being the first layer of subdirectories.

All of the listings below were copied from my browsing of folders as a non privileged user on an ubuntu host. Username and group changed to ae. sudo was never used. The Windows computers are on informal Windows network and shared folders are user/password protected (on the Windows computer using the windows username and password).

$ cd nethood
$ ls -alh
total 12K
drwxrwxrwx 9 ae   ae     0 Dec 31  1969 .
drwxr-xr-x 9 ae   ae    21 Jul 28 11:49 ..
drwxrwxrwx 2 root root   0 Dec 31  1969 WORKGROUP

Browse the workgroup WORKGROUP:

$ ls -alh
total 0
drwxrwxrwx 2 root root  0 Dec 31  1969 .
drwxrwxrwx 9 root root  0 Dec 31  1969 ..
lrwxrwxrwx 1 root root 11 Dec 31  1969 HTPC -> ../HTPC
lrwxrwxrwx 1 root root 14 Dec 31  1969 NEWPC -> ../NEWPC

Change directory to computers and any shared folders will be listed and accessed as normal.

$ cd NEWPC
$ ls -alh
total 0
drwxrwxrwx 2 root root 0 Dec 31  1969 .
drwxrwxrwx 9 root root 0 Dec 31  1969 ..
drwxrwxrwx 2 root root 0 Dec 31  1969 Desktop
drwxrwxrwx 2 root root 0 Dec 31  1969 Users

And the files:

$ cd Desktop/
$ ls -alh
ls: cannot access desktop.ini: No such file or directory
total 30M
drwxrwxrwx 2 root root     0 Dec 31  1969 .
drwxrwxrwx 2 root root     0 Dec 31  1969 ..
-rwxr--r-- 1 ae   ae    1.5K Jan 25  2013 Command Prompt.lnk
-????????? ? ?    ?        ?            ? desktop.ini
-rwxr--r-- 1 ae   ae    156K May 28  2013 Download %25285%2529.iif
-rwxr--r-- 1 ae   ae    2.4K Jul 24 12:28 Google Chrome.lnk
-rwxr--r-- 1 ae   ae     178 Feb  4  2013 import orders.bat
-rwxr--r-- 1 ae   ae    2.3M Mar 30  2012 msvc2008_x86_vcredist_x64.exe
drwxr-xr-x 2 ae   ae       0 May 20  2014 OpenOffice 4.1.0 (en-US) Installation Files
-rwxr--r-- 1 ae   ae    406K Jun  6  2013 Paypal_Jan_1_2012_to_Dec_31_2012.iif
-rwxr--r-- 1 ae   ae     15M May  8  2012 php-5.4.3-Win32-VC9-x86.zip
-rwxr--r-- 1 ae   ae    1.9K Jul 24 13:03 PSPad.lnk
-rwxr--r-- 1 ae   ae    1.1K Jul 24 12:31 VB Demo.lnk

Notice the above directories have ownership root root. File ownership will be the same as your user.

No other users will be able to access the folders regardless of the mount point or that folder's ownership or permissions. If your user can "write" to that folder (and it is empty), smbnetfs will mount the network neighborhood there and not allow anyone else access, even root. For root to have access, you must su ae.

If there are no shared folders, the computer's directory will be empty.

If you do not have credentials to the Windows computer, you may get the error:
ls: cannot open directory .: Input/output error

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.