• luke clemens
    luke clemens

    Does anyone know of a good way to get smb4k to run on startup with root permissions (so it can mount network shares) and auto-mount all the bookmarks when it starts up?

    I want to put some files from a windows shared folder on my website, but servers like apache/cherokee require the shares to be mounted. I've been using fstab, but smb4k is WAY easier - if only there were a way to get it to run on boot and auto-mount!

    • The earliest point Smb4K can be started is after you logged in to your X session. It does not support starts at boot time. However, Smb4K's core library should support shell-only programs (although I never tested this). So, one could try to write a basic shell program that only triggers the mounting, but due to the lack of time and man power that won't be me...

      All other features you mentioned are implemented. Auto-start upon login can either be ensured by copying a link of the Smb4K desktop file to the Autostart folder or by just logging out of the KDE session without closing Smb4K before. Auto-mounting is also supported. The only requirement is, that the shares are mounted upon logout. Just mark the option Shares > Remount recently used shares on program start in the configuration dialog. Auto-mounting of bookmarks is not (yet) supported.

      So, if you need the shares to be mounted at boot time, using the fstab is the way to go. Apart from that, Smb4K should give you everyting you require.

  • luke clemens
    luke clemens

    Thanks for your help Alex...

    I would be happy with auto-start on login, but I can't get that to work.

    I have already tried copying a link into the Autostart folder and checking the "Remount recently used shares on program start". The reason it's failing is a permissions issue. The only way I've ever been able to get smb4k to work is by running "sudo smb4k" from the command line. If I run without "sudo", attempting to mount drives will give me the error message "The following directory could not be created: /home/me/smb4k/WINDOWSPC/E".

    So I tried two different things:

    1) I tried using the autostart link's properties to make it run Smb4K as root, but that ends up causing all kinds of problems. There were tons of errors and lots of popups asking for passwords.
    2) I looked for an option in smb4k that might let it work without root, but I didn't find anything.

    Any other ideas??

    If it helps, I'm running Kubuntu 13.04.

    • Hm, the error message effectively says, that you do not have enough permissions to create subfolders in ~/smb4k. To fix this, please do the following:

      1. Unmount all shares mounted under ~/smb4k.

      2. Open a shell (konsole) and run the following command:

        $ sudo chown -R [login_name]:[your_group] ~/smb4k

      Please replace [login_name] by your login name or your UID and [your_group] by your group or GID. After having done this, you should be able to mount shares in ~/smb4k without the need to use sudo.

      Last edit: Alexander Reinholdt 2013-06-02
  • luke clemens
    luke clemens

    Alexander you are my hero!!

    That's exactly what it needed. I also had to change the ownership for the settings as well ( sudo chown -R xxxxxx:1000 ~/.kde/share/apps/smb4k ) so it doesn't give errors whenever modifying configuration settings within smb4k.

    The password dialog still pops up for kwallet unless you set the password for kwallet to blank, but I can live with that.

    I spent 4+ hours trying to find a solution and you figured it out in seconds. Showoff! lol! :-)

  • MBWD

    Hi Alexander. I can't seem to get smb4k to mount the previously mounted shares on startup. I can get it to start at login . . . but it does not mount the shares that it had mounted at logoff.

    I am using version 1.1.0 (I was hoping there was going to be a new mount bookmarks at login option!). Under "Settings>Shares>Mounting & Unmounting" I have a check next to "Remount rcently used shares on program start" and "5" next to number of remount attempts and "1 min." next to interval between remount attempts."

    As a test, I mounted my bookmarks by "Bookmarks>Mount all bookmarks." I confirmed in the "Mounted Shares" tab that the shares were mounted. Then, leaving smb4k open, I went to terminal and typed "sudo reboot." Unfortunately, upon re-login, the shares do not mount.

    Any idea what is going wrong?

    • Sorry for answering late. I'm quite busy at the moment and not able to respond quickly...

      What happens if you close Smb4K prior to rebooting? What is the result if you leave Smb4K running but reboot via the "Reboot" entry in the K-menu? Are the shares remounted in both cases?

      I suspect that the problem is that the computer is rebooted via the terminal.