I want a network mapping to be available to the user via smbnetfs at system startup without having to type smbnetfs /media/network every time, so I used this entry in /etc/fstab:

smbnetfs /media/network fuse rw,users,noauto,allow_other 0 0

And it works, the mapping is there and it mounts when I click on it using any file manager, but the problem is that it will look for the configuration file at /root/.smb/smbnetfs.conf, and the user won't be able to access the Samba shares with its own credentials.

How can I tell smbnetfs to get the right location for the user configuration file? I didn't want to change the /root/.smb/smbnetfs.conf file because there's different users in need to map this share.


In the Files section of the smbnetfs man page, it says:

Please create configuration directory ~/.smb. This directory should contain at least two files: smb.conf and smbnetfs.conf. You may copy smb.conf from the /etc/samba directory. You can find a sample of smbnetfs.conf in the /etc directory.

If this works as advertised, you should be able to bypass the root conf file there.


Actually the documentation on smbnetfs states that it reads ${HOME}/.smb for the user who issued the mount command and since vmassuchetto making mount through fstab, that user will be root.

There is however a solution: In /root/.smb/smbnetfs.conf is a string:

#read auth data from ~/.smb/smbnetfs.auth
include                    "smbnetfs.auth"

If memory serves me well, by default this should be commented out. If path to smbnetfs.auth isn't provided, as is in above example, smbnet fs will look for it in ~/.smb/. So you can place smbnetfs.auth anywhere on file system and with any permissions to provide the user the way to edit it. I'd suggest vmassuchetto to uncomment this and create a file /root/.smb/smbnetfs.auth with flowing content:


First line will instruct smbnetfs how to handle all not specifically mentioned computers. Second line will instruct smbnetfs how to handle all computers from workgroup and/or domain with that name. Third line will provide credentials for specific computer and forth is for a share on a specific computer. All strings should start with word auth for credentials or with # for comments. All parameters can be encased in " to shield special symbols, same way as "USER_PASSWORD" in example above. Parameter USER_NAME can be specified with leading domain name or workgroup: DOMAIN_OR_WORKGROUP/USER_NAME

And as last resort you can always use this command:


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.