emscom > emscom Help Desk > Knowledgebase

Search help:

Install smbnetfs


SMBNetFS is a user land smbclient that is used to mount Windows network shares (cifs/smb) to a Linux file system on demand.  Unlike the mount command smbnetfs doew not require root privilege

An smbnetfs package is available within most of the mainstream distro repositories.

See attached document for set up instructions.

Windows shares will require a mount point in the user home folder

mkdir ~/smbnet

smbnetfs configuration files are located in a hidden folder within the user home folder

mkdir ~/.smb

The default configuration template can be copied to the configuration folder

cp /etc/smbnetfs.conf ~/.smb/.

A Windows share or complete host can be mounted as follows

smbnetfs ~/smbnetfs

To list the shares on a Windows or CIFS host

ls ~/smbnet/user@hostname/

After connecting to the host the filesystem is navigated as usual

cd ~/smbnet/user@hostname/share/folder

An authenticaiton file can be usef to automatically forward usernames and passwords

touch ~/.smbnetfs.auth

chmod 600 ~/smbnetfs.auth

Hostname reminders may be added to the mountpoint

mkdir ~/smbnet/hostname





Setting up smbnetfs

SMB directories in Thunar can be opened in the same way as described for SFTP. If you do not use this often, then no difficulties usually arise. Otherwise, it may be more convenient to use the smbnetfs package, which is based on the FUSE subsystem. An additional bonus is that ordinary programs that do not know about the existence of GVFS will be able to work with network folders.

Install the smbnetfs package:

# apt-get install smbnetfs

Let's add the user who will use the package to the fuse group:

# usermod -aG fuse stupin

In the user's home directory, create a directory with settings:


And in it there is a config for connecting to servers ~/.smb/smbnetfs.conf, containing credentials for connecting to network directories.

You can specify, using a forward slash, the server and directory for which specific credentials should be used as follows:

auth "SERVER/SHARE" "username" "password"

Instead of a server with a directory, you can specify only the server name or only the workgroup name, like this:

auth "SERVER" "username" "password"

auth "WORKGROUP" "username" "password"

For all other connections, you can only set a name and password:

Don't forget to make the settings file accessible only to the owner:

$ chmod go= ~/.smb/smbnetfs.conf

Now all that remains is to create a directory into which the network content will be displayed, and mount the SMB network view into it.

$ mkdir ~/smb

$ smbnetfs -o direct_io,readdir_ino ~/smb

To automatically mount the network when you log into XFCE, you can enter the following command into autorun:

/usr/bin/smbnetfs -o direct_io,readdir_ino /home/stupin/smb

Open "Sessions and startup" in the XFCE settings: Go to the "Autostart applications" tab, add a new element (on the page): Enter the autostart command and explanatory text: Mark this element as active: Now, immediately after logging in with your account, you can log into smb directory and see the contents of the network. At the first level of the hierarchy there will be workgroups, then servers, then shared directories, and then directories and files inside the shared folder. For example, a snapshot of the Thunar window:




Was this article helpful? yes / no
Related articles Linux Mount SMB shared folder
QNAP Shared Folders
OSX SSH login
QNAP Factory Defaults
Linux change permissions conditionally
Article details
Article ID: 222
Category: Linux
Date added: 13-02-2024 16:31:10
Views: 27
Rating (Votes): Article not rated yet (0)

« Go back

Powered by Help Desk Software HESK, in partnership with SysAid Technologies