Mounting SMB shares using URL under GNOME and KDE

As most Linux users are aware, you can access network shares with your file browser of choice (Dolphin, Nautilus and probably others) by writing URLs into the file browser’s “location bar”(1).

If you ever had to work with MS-Windows file server, you should know that you can also access SMB file shares using URLs – with the schema “smb”, like this: smb://file-server/share-name.

Using a URL like that will ask the file browser to open an SMB connection to the file server and try to list the content of the share. If your file server is not of the kind that likes anonymous users, a password dialog would come up where you have to enter a user name and a password, and a domain name. Nautilus will show an authentication dialog with a “domain” field pre-filled with the domain name “WORKGROUP” (which is unlikly to be what you want), while in KDE there is no distinct field for the domain as it expects MS-Windows like “DOMAIN\user” format, which users are likely not accustomed to. If you now type in your password and ask it to be saved, at best the file browser will open the share but not save the password and you will have to type it again the next time, while at worst – the browser will not be able to list the share and prompt you for the password again and again.

A useful way to workaround the issue is to have the “domain” part already in the “smb://” URL – that way the authentication process and the password keyring manager(2) already knows the correct MS-Windows domain name to log in with and will either pre-fill it in the correct field.

GNOME and Nautilus

In GNOME (and using the GVFS command line tools – more about it later), the format of the URL is smb://domain;user@server/share, so for example if your domain name is “OFFICE” and your user is “oded”, and you want to access the share “Documents” on the server “files”, then the URL will be smb://OFFICE;oded@files/Documents:

The password saving feature will now work fine and you can even bookmark the location and if you save the password, then next time you can just click the bookmark to automatically connect to the share.

KDE and Dolphin

In KDE the format of the URL is smb://domain\user@server/share (similar to the user specification in MS-Windows), so using the same example above the URL will be smb://OFFICE\oded@files/Documents:

As you can see, the user name field is pre-filled with the MS-Windows user specification and you are left with only putting in the password. You can also note that Dolphin has “URL encoded” the back-slash character – don’t worry about it, it will work just fine and you can also bookmark this location and the “Remember password” will faithfully keep your password regardless if the URL is “URL encoded” or not.


  1. and this works just as well with the desktop’s “run dialog” – try holding ALT-F2 and typing something like ftp://ftp.mirrorservice.org/ and up comes your file browser showing the FTP site’s directories. This won’t work for GNOME 3, at least at this time. []
  2. GNOME’s keyring or KDE’s wallet []

Leave a Reply

 

 


Close

Loading ...

Sorry :(

Can't connect ... Please try again later.