Results 1 to 5 of 5

Thread: Automount sshfs

  1. #1
    Join Date
    Aug 2012
    Beans
    1

    Automount sshfs

    Hi,

    I've been trying to automount my ssh server at startup, but I can't get it working.

    I use the following script to mount the ssh:
    #!/bin/bash
    if sshfs -o idmap=user server@server: /home/herbert/Server
    then
    zenity --info --timeout 1 --text "Server mounted."
    fi

    I've tried inserting the script into rc.local. I have tried to execute it through .config/autostart and I have also tried mounting it through fstab.. None of it worked

    If I run the following: sudo /etc/init.d/rc.local start
    The server mounts fine, but it just wont mount on bootup.

    Can someone please walk me through the best way to automount with sshfs on Lubuntu?

    Thank you so much.
    Last edited by hgaronfolo; August 24th, 2012 at 11:50 AM.

  2. #2
    Join Date
    Apr 2010
    Beans
    39

    Re: Automount sshfs

    I would write the script in a separate file in /etc/init.d/
    This script should have a start option to mount and a stop option to umount and a text interface.
    Then execute:
    Code:
    update-rc.d <script> enable
    this command should create links in /etc/rc?.d/ so i would test that
    Code:
    ll -rt rc2.d
    you shold find there a link to your script whose name begins by S and a number. This means that when system enters in runlevel 2 this service will start.

    But you may prefer to put your script to run when XFCE starts:
    Menu > Settings > Settings Manager > Session and Startup > Application Autostart >Add...

    good luck!

  3. #3
    Join Date
    Dec 2009
    Beans
    6,777

    Re: Automount sshfs

    Can someone please walk me through the best way to automount with sshfs on Lubuntu?
    I don't know if there is a "best" way but there is "another" way - Gigolo: http://ubuntuforums.org/showpost.php...16&postcount=3

    It talks specifically about Samba share mounting but Gigolo can automount using several protocols.

  4. #4
    Join Date
    Apr 2010
    Beans
    39

    Re: Automount sshfs

    Or maybe using fstab. Here explains how to do it:

    http://ubuntuforums.org/showthread.php?t=430312

    /etc/fstab is the file where you say to the computer whre to mount things, so I think that this may be a good way.

  5. #5
    Join Date
    Aug 2012
    Beans
    9

    Re: Automount sshfs

    Assuming you're using certificates to ssh into your server, I'd bet your problem is related to the fact that /etc/rc.local is sourced as root when launched from the init sequence.

    If this is it you have two alternatives to work it out:
    1) Generate a certificate for the user root on your local computer and ssh-copy-id it to the authorized keys on server@server. This way your remote directory will be mounted locally as root.
    2) Modify your rc.local script to run the sshfs command as your herbert user, that is:
    Code:
    sudo herbert -c "sshfs -o idmap=user server@server: /home/herbert/Server"
    Doing it this way, your remote directory will be mounted as herbert locally.

    Good luck!

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •