I have some music files I'd like to listen to sitting on a Samba share. I added this share via the Ubuntu GUI (Places -> Connect to server...), and everything worked just fine.

However, despite the fact that my music file is playing from this location, after I've not touched the location using the Nautilus GUI, Ubuntu/GNOME decides that I'm not using the share anymore and terminates the connection. Thus, my music stops playing and Rhythmbox is unhappy with me. Simply clicking on the new shortcut the "Connect to server..." bit created for me immediately makes the files come back again and allows me to restart the music playing.

How can I have Ubuntu not automatically dismount samba shares?

4 Answers 4


This is the method I have used successfully from 9.10 through 10.10 by mounting the shares with fstab following these steps.

  1. Make sure you have smbfs installed first.

  2. Create new directory(s) to mount the share to in terminal eg sudo mkdir /media/my_share

  3. Open fstab in gedit gksudo gedit /etc/fstab also in terminal

  4. Add one line per share example music, films, tv etc

    // /media/my_share cifs credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

    obviously changing the IP address, share_name and my_share to the relevant folders

  5. Lastly create a hidden .smbcredentials file in root and open it in gedit

    gksudo gedit /root/.smbcredentials

    and add these lines to the new file


    if you have no password for the shares then leave them blank and if you have many different share passwords then create multiple credentials files.

    you will then need to change the owner of the credentials file

    sudo chmod 700 /root/.smbcredentials

once all of this is in place you can test your setup by typing sudo mount -a in the terminal and your shares will be mounted.

from now on they will automatically mount when you log in.

  • ps it still kicks me off but only once or twice a month which is possibly to do with the dhcp updating on my router.
    – Allan
    Feb 3, 2011 at 11:27

This is a problem with GVFS. See this post for a workaround. Hopefully someone adds a better way to do this. As an alternative you could use the standard mount-command, which does not have these limitations.


If you have a server, it may be worth moving it over to a fixed IP... If it's Ubuntu Server look here: How To Geek (Ignore the line sudo apt-get remove dhcp-client as there's no need for it)

  • It is a fixed IP. The ubuntu box is a VMWare VM running inside VMWare Workstation. The host machine for VMWare Workstation is the one serving the share -- no network cable or LAN is involved. Feb 3, 2011 at 16:06

Im pretty sure samba times itself out after a time and unmounts. Its a security feature I think (even if you are connecting to a share without a password).

  • Why would the client care for security reasons about leaving a connection open to the server? If the server was killing the connection I could understand, but this is entirely Ubuntu's issue. Feb 3, 2011 at 10:11
  • Samba shares don't do that naturally. I have a samba share that has stayed mounted for weeks.
    – djeikyb
    Feb 3, 2011 at 11:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .