How to mount an SMB share on Linux as normal user on the commandline nowadays?
This is basically the issue I mentioned in my answer to User space application for CIFS reformulated as question as I currently don't know a real solution.
In the past there was a tool called smbmount
(usually in a package called smbfs
) available in most Linux distributions with which unprivileged users could mount an SMB share somewhere where they have write permission. But at least recent cifs-utils
packages in Debian no more ship these programs and I don't see similar replacement programmes with a cifs
prefix in that package.
There are two packages (fusesmb
and smbnetfuse
) available which provide a single mount point which can give access to either multiple configured SMB shares or shows the all the local SMB servers like the network tree view in the Windows Explorer. But that's not really what I look for, especially because I don't want to store passwords on the file system in plaintext (as fusesmb
seems to require) but enter it once at mount time. I tried fusesmb
nevertheless, but didn't get it to work, the mountpoint was always empty and I saw no error messages or the like. Additionally, the fusesmb
documentation is very scarce.
So I wonder: How do I mount an SMB share on Linux as normal user nowadays (i.e. in 2015)? I'd be fine with both, either some fuse
based tool (preferred) or some setuid tool (like smbmount
was IIRC).
I know about the GVFS and KIO subsystems of desktop environments, but I need something which can be done on the commandline and AFAIK neither GVFS nor KIO do real mounts but just open an Windows Explorer like window which shows the contents of such a share.
Of course I also now about the ftp
-like smbclient
and I know about the network browsers smb4k
for KDE and the ncurses-based smbc
. But they all don't help here either.
Or to make a comparison: I want sshfs
, just for SMB instead of SFTP. :-)
Solution 1:
GVFS mounts can be used from the command line with gio mount
when there is a dbus enviroment is available. The mount points appear under /var/run/user/[uid]/gvfs
.
See also the answer to Samba mount with password prompt as non-root user.