How to auto mount using sshfs?












13















I am using the following command to mount a ssh ubuntu directory to my ubuntu pc.



sshfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx


My question is, can I create a script for this in my desktop where I can make a double click and run this script when ever I need to mount the drive without manually typing the command always.










share|improve this question



























    13















    I am using the following command to mount a ssh ubuntu directory to my ubuntu pc.



    sshfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx


    My question is, can I create a script for this in my desktop where I can make a double click and run this script when ever I need to mount the drive without manually typing the command always.










    share|improve this question

























      13












      13








      13


      6






      I am using the following command to mount a ssh ubuntu directory to my ubuntu pc.



      sshfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx


      My question is, can I create a script for this in my desktop where I can make a double click and run this script when ever I need to mount the drive without manually typing the command always.










      share|improve this question














      I am using the following command to mount a ssh ubuntu directory to my ubuntu pc.



      sshfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx


      My question is, can I create a script for this in my desktop where I can make a double click and run this script when ever I need to mount the drive without manually typing the command always.







      sshfs






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 17 '11 at 7:53









      BlueBirdBlueBird

      2202311




      2202311






















          6 Answers
          6






          active

          oldest

          votes


















          13














          You could create a launcher and add it to your launcher bar by drag&dropping the .desktop-file there:



              #!/usr/bin/env xdg-open

          [Desktop Entry]
          Version=1.0
          Type=Application
          Terminal=false
          Icon[en_US]=nautilus
          Name[en_US]=Connect to xy
          Exec=shfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx
          #OR: to mount and than open in nautilus (note the '/dir' where ':dir' used to be)
          #Exec=nautilus sftp://user@192.xx.xx.xx.xx/dir/dir
          Comment[en_US]=Connect to xy via ssh
          Name=Connect to xy
          Comment=Connect to xy via ssh
          Icon=nautilus


          Suggestion - even less work:



          If you want even less work (=autoconnect) and a graphical user interface, you might want to check out Gigolo Install gigolo. It has the capability of auto-mounting a bookmark, whenever the bookmarked filesystem is present. You might want to check that out.



          sudo apt-get install gigolo   # or use the install link above


          Run gigolo. There is an option in the preferences that puts it into autostart and another to activate the tray icon. Check both. Then add your bookmark.



          Here is a screenshot:



          enter image description here



          Shell way



          Another solution would be to put the following line in your crontab (edit /etc/crontab with sudo privileges):



          @reboot sshfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx


          But since Ubuntu's password manager is not present when the command is run you need to use a password-less private/public key pair to authenticate with the ssh server in question (or a similar method of authentication). This would mount it on every reboot.



          Yet another solution would be to edit your /etc/fstab (providing your Ubuntu-Version provides that option).






          share|improve this answer





















          • 1





            I can not use gigolo. Coz I want to use a specific mounting point within my home folder. Your first solution seems good. But I am not clear about the file naming. YOu have given ".desktop-file" Is that the file name or extension to be. Please give me more example on the file naming. THen I can try it.

            – BlueBird
            May 18 '11 at 10:33











          • It's the extension. All launchers in ubuntu end with ".desktop". Create an empty file. Copy the text I posted above into it. Replace the text behind "Name=" by whatever suits you and substitute the real paths in the the text behind "Exec=". Then Save it as "connect.desktop" or "mountxy.desktop" (for example). After you saved the file Drag&Drop it into your launcher panel or where ever you want it.

            – con-f-use
            May 18 '11 at 14:34













          • Great!! It worked.

            – BlueBird
            May 19 '11 at 6:17






          • 7





            OMG... worst name ever for a program.

            – Lekensteyn
            Jul 6 '11 at 7:47











          • Apparently there's no option to add gigolo to autostart anymore, so you'll have to do it yourself. Run gnome-session-properties and add /usr/bin/gigolo command. It's not possible to select a mount point, but you can create a symbolic link to your home directory (with ln -s). You can find the original mount point by right-clicking a folder in file manager and selecting Open in Local Terminal.

            – Seppo Enarvi
            Sep 25 '18 at 8:21





















          4














          This forum thread shows a method of creating an automounting SSHFS which seems to me exactly what you would like to do.






          share|improve this answer


























          • Great article. Thanks for your pointer

            – Tuan Anh Hoang-Vu
            Oct 4 '12 at 19:42



















          3














          You can simply type this to a shell script, and you can create a launcher for it at the desktop.



          For example mountssh.sh:



          #!/bin/bash
          shfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx


          make sure to chmod +x mountssh.sh and then clicking it will execute



          Alternatively, you can mount it via gvfs, by right clicking at the desktop, and creating a launcher with URL parameter: ssh://user@192.xx.xx.xx.xx/dir/dir. By default it mounts to ~/.gvfs/.... If you want stick with the /home/username/mount/xxx, you can create symlink from the gvfs one to this.






          share|improve this answer


























          • I created the file "mount-192.168.1.5.sh" on my desktop. When I double click it, it is opened with gedit.

            – BlueBird
            May 18 '11 at 10:28











          • You have to create this sh file with executable priviliges anywhere, and create a launcher at your desktop, which points to this .sh file.

            – Iradrian
            May 18 '11 at 12:29



















          2














          You could even take it a step further and have autofs take care of the mounting for you. Since autofs doesn't work particularly well with SSH public key authentication (unless you want to create a passwordless key pair for the superuser), there are tools that allow you to use the user's SSH keys, ssh-agent and keychain:





          • autosshfs: per user SSHFS automount using user's SSH configuration


          • afuse: an automounter implemented with FUSE






          share|improve this answer

































            0














            I mount a folder the exact same way, what i did was create a custom launcher that points to a .sh file that contains the command. Just make sure the file has execution permission and you're good to go.



            I just click on the launcher:



            enter image description here






            share|improve this answer































              0














              I tried to use cron to automatically mount ssh directory, but it causes an error saying Network is unreachable. It is because the cron job execution is too early to establish ip connections. After I inserted sleep before the sshfs command, it successfully mount the ssh directory.



              sleep 5 && sshfs ......


              So I made this script to fulfill my requirement.



              #! /bin/sh
              while true
              do
              ping -c1 -w1 ssh_server_ip > /dev/null && break
              done
              sshfs -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 sshname:/mountpath /localmountpath





              share|improve this answer























                Your Answer








                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "89"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f43363%2fhow-to-auto-mount-using-sshfs%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                6 Answers
                6






                active

                oldest

                votes








                6 Answers
                6






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                13














                You could create a launcher and add it to your launcher bar by drag&dropping the .desktop-file there:



                    #!/usr/bin/env xdg-open

                [Desktop Entry]
                Version=1.0
                Type=Application
                Terminal=false
                Icon[en_US]=nautilus
                Name[en_US]=Connect to xy
                Exec=shfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx
                #OR: to mount and than open in nautilus (note the '/dir' where ':dir' used to be)
                #Exec=nautilus sftp://user@192.xx.xx.xx.xx/dir/dir
                Comment[en_US]=Connect to xy via ssh
                Name=Connect to xy
                Comment=Connect to xy via ssh
                Icon=nautilus


                Suggestion - even less work:



                If you want even less work (=autoconnect) and a graphical user interface, you might want to check out Gigolo Install gigolo. It has the capability of auto-mounting a bookmark, whenever the bookmarked filesystem is present. You might want to check that out.



                sudo apt-get install gigolo   # or use the install link above


                Run gigolo. There is an option in the preferences that puts it into autostart and another to activate the tray icon. Check both. Then add your bookmark.



                Here is a screenshot:



                enter image description here



                Shell way



                Another solution would be to put the following line in your crontab (edit /etc/crontab with sudo privileges):



                @reboot sshfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx


                But since Ubuntu's password manager is not present when the command is run you need to use a password-less private/public key pair to authenticate with the ssh server in question (or a similar method of authentication). This would mount it on every reboot.



                Yet another solution would be to edit your /etc/fstab (providing your Ubuntu-Version provides that option).






                share|improve this answer





















                • 1





                  I can not use gigolo. Coz I want to use a specific mounting point within my home folder. Your first solution seems good. But I am not clear about the file naming. YOu have given ".desktop-file" Is that the file name or extension to be. Please give me more example on the file naming. THen I can try it.

                  – BlueBird
                  May 18 '11 at 10:33











                • It's the extension. All launchers in ubuntu end with ".desktop". Create an empty file. Copy the text I posted above into it. Replace the text behind "Name=" by whatever suits you and substitute the real paths in the the text behind "Exec=". Then Save it as "connect.desktop" or "mountxy.desktop" (for example). After you saved the file Drag&Drop it into your launcher panel or where ever you want it.

                  – con-f-use
                  May 18 '11 at 14:34













                • Great!! It worked.

                  – BlueBird
                  May 19 '11 at 6:17






                • 7





                  OMG... worst name ever for a program.

                  – Lekensteyn
                  Jul 6 '11 at 7:47











                • Apparently there's no option to add gigolo to autostart anymore, so you'll have to do it yourself. Run gnome-session-properties and add /usr/bin/gigolo command. It's not possible to select a mount point, but you can create a symbolic link to your home directory (with ln -s). You can find the original mount point by right-clicking a folder in file manager and selecting Open in Local Terminal.

                  – Seppo Enarvi
                  Sep 25 '18 at 8:21


















                13














                You could create a launcher and add it to your launcher bar by drag&dropping the .desktop-file there:



                    #!/usr/bin/env xdg-open

                [Desktop Entry]
                Version=1.0
                Type=Application
                Terminal=false
                Icon[en_US]=nautilus
                Name[en_US]=Connect to xy
                Exec=shfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx
                #OR: to mount and than open in nautilus (note the '/dir' where ':dir' used to be)
                #Exec=nautilus sftp://user@192.xx.xx.xx.xx/dir/dir
                Comment[en_US]=Connect to xy via ssh
                Name=Connect to xy
                Comment=Connect to xy via ssh
                Icon=nautilus


                Suggestion - even less work:



                If you want even less work (=autoconnect) and a graphical user interface, you might want to check out Gigolo Install gigolo. It has the capability of auto-mounting a bookmark, whenever the bookmarked filesystem is present. You might want to check that out.



                sudo apt-get install gigolo   # or use the install link above


                Run gigolo. There is an option in the preferences that puts it into autostart and another to activate the tray icon. Check both. Then add your bookmark.



                Here is a screenshot:



                enter image description here



                Shell way



                Another solution would be to put the following line in your crontab (edit /etc/crontab with sudo privileges):



                @reboot sshfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx


                But since Ubuntu's password manager is not present when the command is run you need to use a password-less private/public key pair to authenticate with the ssh server in question (or a similar method of authentication). This would mount it on every reboot.



                Yet another solution would be to edit your /etc/fstab (providing your Ubuntu-Version provides that option).






                share|improve this answer





















                • 1





                  I can not use gigolo. Coz I want to use a specific mounting point within my home folder. Your first solution seems good. But I am not clear about the file naming. YOu have given ".desktop-file" Is that the file name or extension to be. Please give me more example on the file naming. THen I can try it.

                  – BlueBird
                  May 18 '11 at 10:33











                • It's the extension. All launchers in ubuntu end with ".desktop". Create an empty file. Copy the text I posted above into it. Replace the text behind "Name=" by whatever suits you and substitute the real paths in the the text behind "Exec=". Then Save it as "connect.desktop" or "mountxy.desktop" (for example). After you saved the file Drag&Drop it into your launcher panel or where ever you want it.

                  – con-f-use
                  May 18 '11 at 14:34













                • Great!! It worked.

                  – BlueBird
                  May 19 '11 at 6:17






                • 7





                  OMG... worst name ever for a program.

                  – Lekensteyn
                  Jul 6 '11 at 7:47











                • Apparently there's no option to add gigolo to autostart anymore, so you'll have to do it yourself. Run gnome-session-properties and add /usr/bin/gigolo command. It's not possible to select a mount point, but you can create a symbolic link to your home directory (with ln -s). You can find the original mount point by right-clicking a folder in file manager and selecting Open in Local Terminal.

                  – Seppo Enarvi
                  Sep 25 '18 at 8:21
















                13












                13








                13







                You could create a launcher and add it to your launcher bar by drag&dropping the .desktop-file there:



                    #!/usr/bin/env xdg-open

                [Desktop Entry]
                Version=1.0
                Type=Application
                Terminal=false
                Icon[en_US]=nautilus
                Name[en_US]=Connect to xy
                Exec=shfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx
                #OR: to mount and than open in nautilus (note the '/dir' where ':dir' used to be)
                #Exec=nautilus sftp://user@192.xx.xx.xx.xx/dir/dir
                Comment[en_US]=Connect to xy via ssh
                Name=Connect to xy
                Comment=Connect to xy via ssh
                Icon=nautilus


                Suggestion - even less work:



                If you want even less work (=autoconnect) and a graphical user interface, you might want to check out Gigolo Install gigolo. It has the capability of auto-mounting a bookmark, whenever the bookmarked filesystem is present. You might want to check that out.



                sudo apt-get install gigolo   # or use the install link above


                Run gigolo. There is an option in the preferences that puts it into autostart and another to activate the tray icon. Check both. Then add your bookmark.



                Here is a screenshot:



                enter image description here



                Shell way



                Another solution would be to put the following line in your crontab (edit /etc/crontab with sudo privileges):



                @reboot sshfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx


                But since Ubuntu's password manager is not present when the command is run you need to use a password-less private/public key pair to authenticate with the ssh server in question (or a similar method of authentication). This would mount it on every reboot.



                Yet another solution would be to edit your /etc/fstab (providing your Ubuntu-Version provides that option).






                share|improve this answer















                You could create a launcher and add it to your launcher bar by drag&dropping the .desktop-file there:



                    #!/usr/bin/env xdg-open

                [Desktop Entry]
                Version=1.0
                Type=Application
                Terminal=false
                Icon[en_US]=nautilus
                Name[en_US]=Connect to xy
                Exec=shfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx
                #OR: to mount and than open in nautilus (note the '/dir' where ':dir' used to be)
                #Exec=nautilus sftp://user@192.xx.xx.xx.xx/dir/dir
                Comment[en_US]=Connect to xy via ssh
                Name=Connect to xy
                Comment=Connect to xy via ssh
                Icon=nautilus


                Suggestion - even less work:



                If you want even less work (=autoconnect) and a graphical user interface, you might want to check out Gigolo Install gigolo. It has the capability of auto-mounting a bookmark, whenever the bookmarked filesystem is present. You might want to check that out.



                sudo apt-get install gigolo   # or use the install link above


                Run gigolo. There is an option in the preferences that puts it into autostart and another to activate the tray icon. Check both. Then add your bookmark.



                Here is a screenshot:



                enter image description here



                Shell way



                Another solution would be to put the following line in your crontab (edit /etc/crontab with sudo privileges):



                @reboot sshfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx


                But since Ubuntu's password manager is not present when the command is run you need to use a password-less private/public key pair to authenticate with the ssh server in question (or a similar method of authentication). This would mount it on every reboot.



                Yet another solution would be to edit your /etc/fstab (providing your Ubuntu-Version provides that option).







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 14 '17 at 9:37









                jokerdino

                32.8k21120187




                32.8k21120187










                answered May 17 '11 at 9:32









                con-f-usecon-f-use

                12.9k1774136




                12.9k1774136








                • 1





                  I can not use gigolo. Coz I want to use a specific mounting point within my home folder. Your first solution seems good. But I am not clear about the file naming. YOu have given ".desktop-file" Is that the file name or extension to be. Please give me more example on the file naming. THen I can try it.

                  – BlueBird
                  May 18 '11 at 10:33











                • It's the extension. All launchers in ubuntu end with ".desktop". Create an empty file. Copy the text I posted above into it. Replace the text behind "Name=" by whatever suits you and substitute the real paths in the the text behind "Exec=". Then Save it as "connect.desktop" or "mountxy.desktop" (for example). After you saved the file Drag&Drop it into your launcher panel or where ever you want it.

                  – con-f-use
                  May 18 '11 at 14:34













                • Great!! It worked.

                  – BlueBird
                  May 19 '11 at 6:17






                • 7





                  OMG... worst name ever for a program.

                  – Lekensteyn
                  Jul 6 '11 at 7:47











                • Apparently there's no option to add gigolo to autostart anymore, so you'll have to do it yourself. Run gnome-session-properties and add /usr/bin/gigolo command. It's not possible to select a mount point, but you can create a symbolic link to your home directory (with ln -s). You can find the original mount point by right-clicking a folder in file manager and selecting Open in Local Terminal.

                  – Seppo Enarvi
                  Sep 25 '18 at 8:21
















                • 1





                  I can not use gigolo. Coz I want to use a specific mounting point within my home folder. Your first solution seems good. But I am not clear about the file naming. YOu have given ".desktop-file" Is that the file name or extension to be. Please give me more example on the file naming. THen I can try it.

                  – BlueBird
                  May 18 '11 at 10:33











                • It's the extension. All launchers in ubuntu end with ".desktop". Create an empty file. Copy the text I posted above into it. Replace the text behind "Name=" by whatever suits you and substitute the real paths in the the text behind "Exec=". Then Save it as "connect.desktop" or "mountxy.desktop" (for example). After you saved the file Drag&Drop it into your launcher panel or where ever you want it.

                  – con-f-use
                  May 18 '11 at 14:34













                • Great!! It worked.

                  – BlueBird
                  May 19 '11 at 6:17






                • 7





                  OMG... worst name ever for a program.

                  – Lekensteyn
                  Jul 6 '11 at 7:47











                • Apparently there's no option to add gigolo to autostart anymore, so you'll have to do it yourself. Run gnome-session-properties and add /usr/bin/gigolo command. It's not possible to select a mount point, but you can create a symbolic link to your home directory (with ln -s). You can find the original mount point by right-clicking a folder in file manager and selecting Open in Local Terminal.

                  – Seppo Enarvi
                  Sep 25 '18 at 8:21










                1




                1





                I can not use gigolo. Coz I want to use a specific mounting point within my home folder. Your first solution seems good. But I am not clear about the file naming. YOu have given ".desktop-file" Is that the file name or extension to be. Please give me more example on the file naming. THen I can try it.

                – BlueBird
                May 18 '11 at 10:33





                I can not use gigolo. Coz I want to use a specific mounting point within my home folder. Your first solution seems good. But I am not clear about the file naming. YOu have given ".desktop-file" Is that the file name or extension to be. Please give me more example on the file naming. THen I can try it.

                – BlueBird
                May 18 '11 at 10:33













                It's the extension. All launchers in ubuntu end with ".desktop". Create an empty file. Copy the text I posted above into it. Replace the text behind "Name=" by whatever suits you and substitute the real paths in the the text behind "Exec=". Then Save it as "connect.desktop" or "mountxy.desktop" (for example). After you saved the file Drag&Drop it into your launcher panel or where ever you want it.

                – con-f-use
                May 18 '11 at 14:34







                It's the extension. All launchers in ubuntu end with ".desktop". Create an empty file. Copy the text I posted above into it. Replace the text behind "Name=" by whatever suits you and substitute the real paths in the the text behind "Exec=". Then Save it as "connect.desktop" or "mountxy.desktop" (for example). After you saved the file Drag&Drop it into your launcher panel or where ever you want it.

                – con-f-use
                May 18 '11 at 14:34















                Great!! It worked.

                – BlueBird
                May 19 '11 at 6:17





                Great!! It worked.

                – BlueBird
                May 19 '11 at 6:17




                7




                7





                OMG... worst name ever for a program.

                – Lekensteyn
                Jul 6 '11 at 7:47





                OMG... worst name ever for a program.

                – Lekensteyn
                Jul 6 '11 at 7:47













                Apparently there's no option to add gigolo to autostart anymore, so you'll have to do it yourself. Run gnome-session-properties and add /usr/bin/gigolo command. It's not possible to select a mount point, but you can create a symbolic link to your home directory (with ln -s). You can find the original mount point by right-clicking a folder in file manager and selecting Open in Local Terminal.

                – Seppo Enarvi
                Sep 25 '18 at 8:21







                Apparently there's no option to add gigolo to autostart anymore, so you'll have to do it yourself. Run gnome-session-properties and add /usr/bin/gigolo command. It's not possible to select a mount point, but you can create a symbolic link to your home directory (with ln -s). You can find the original mount point by right-clicking a folder in file manager and selecting Open in Local Terminal.

                – Seppo Enarvi
                Sep 25 '18 at 8:21















                4














                This forum thread shows a method of creating an automounting SSHFS which seems to me exactly what you would like to do.






                share|improve this answer


























                • Great article. Thanks for your pointer

                  – Tuan Anh Hoang-Vu
                  Oct 4 '12 at 19:42
















                4














                This forum thread shows a method of creating an automounting SSHFS which seems to me exactly what you would like to do.






                share|improve this answer


























                • Great article. Thanks for your pointer

                  – Tuan Anh Hoang-Vu
                  Oct 4 '12 at 19:42














                4












                4








                4







                This forum thread shows a method of creating an automounting SSHFS which seems to me exactly what you would like to do.






                share|improve this answer















                This forum thread shows a method of creating an automounting SSHFS which seems to me exactly what you would like to do.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 17 '17 at 18:21









                Zanna

                50.9k13136241




                50.9k13136241










                answered Jul 6 '11 at 7:11









                lbrownlbrown

                411




                411













                • Great article. Thanks for your pointer

                  – Tuan Anh Hoang-Vu
                  Oct 4 '12 at 19:42



















                • Great article. Thanks for your pointer

                  – Tuan Anh Hoang-Vu
                  Oct 4 '12 at 19:42

















                Great article. Thanks for your pointer

                – Tuan Anh Hoang-Vu
                Oct 4 '12 at 19:42





                Great article. Thanks for your pointer

                – Tuan Anh Hoang-Vu
                Oct 4 '12 at 19:42











                3














                You can simply type this to a shell script, and you can create a launcher for it at the desktop.



                For example mountssh.sh:



                #!/bin/bash
                shfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx


                make sure to chmod +x mountssh.sh and then clicking it will execute



                Alternatively, you can mount it via gvfs, by right clicking at the desktop, and creating a launcher with URL parameter: ssh://user@192.xx.xx.xx.xx/dir/dir. By default it mounts to ~/.gvfs/.... If you want stick with the /home/username/mount/xxx, you can create symlink from the gvfs one to this.






                share|improve this answer


























                • I created the file "mount-192.168.1.5.sh" on my desktop. When I double click it, it is opened with gedit.

                  – BlueBird
                  May 18 '11 at 10:28











                • You have to create this sh file with executable priviliges anywhere, and create a launcher at your desktop, which points to this .sh file.

                  – Iradrian
                  May 18 '11 at 12:29
















                3














                You can simply type this to a shell script, and you can create a launcher for it at the desktop.



                For example mountssh.sh:



                #!/bin/bash
                shfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx


                make sure to chmod +x mountssh.sh and then clicking it will execute



                Alternatively, you can mount it via gvfs, by right clicking at the desktop, and creating a launcher with URL parameter: ssh://user@192.xx.xx.xx.xx/dir/dir. By default it mounts to ~/.gvfs/.... If you want stick with the /home/username/mount/xxx, you can create symlink from the gvfs one to this.






                share|improve this answer


























                • I created the file "mount-192.168.1.5.sh" on my desktop. When I double click it, it is opened with gedit.

                  – BlueBird
                  May 18 '11 at 10:28











                • You have to create this sh file with executable priviliges anywhere, and create a launcher at your desktop, which points to this .sh file.

                  – Iradrian
                  May 18 '11 at 12:29














                3












                3








                3







                You can simply type this to a shell script, and you can create a launcher for it at the desktop.



                For example mountssh.sh:



                #!/bin/bash
                shfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx


                make sure to chmod +x mountssh.sh and then clicking it will execute



                Alternatively, you can mount it via gvfs, by right clicking at the desktop, and creating a launcher with URL parameter: ssh://user@192.xx.xx.xx.xx/dir/dir. By default it mounts to ~/.gvfs/.... If you want stick with the /home/username/mount/xxx, you can create symlink from the gvfs one to this.






                share|improve this answer















                You can simply type this to a shell script, and you can create a launcher for it at the desktop.



                For example mountssh.sh:



                #!/bin/bash
                shfs user@192.xx.xx.xx.xx:/dir/dir /home/username/mount/xxx


                make sure to chmod +x mountssh.sh and then clicking it will execute



                Alternatively, you can mount it via gvfs, by right clicking at the desktop, and creating a launcher with URL parameter: ssh://user@192.xx.xx.xx.xx/dir/dir. By default it mounts to ~/.gvfs/.... If you want stick with the /home/username/mount/xxx, you can create symlink from the gvfs one to this.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jul 13 '13 at 0:16









                Jacob Minshall

                33




                33










                answered May 17 '11 at 8:36









                IradrianIradrian

                1,1731911




                1,1731911













                • I created the file "mount-192.168.1.5.sh" on my desktop. When I double click it, it is opened with gedit.

                  – BlueBird
                  May 18 '11 at 10:28











                • You have to create this sh file with executable priviliges anywhere, and create a launcher at your desktop, which points to this .sh file.

                  – Iradrian
                  May 18 '11 at 12:29



















                • I created the file "mount-192.168.1.5.sh" on my desktop. When I double click it, it is opened with gedit.

                  – BlueBird
                  May 18 '11 at 10:28











                • You have to create this sh file with executable priviliges anywhere, and create a launcher at your desktop, which points to this .sh file.

                  – Iradrian
                  May 18 '11 at 12:29

















                I created the file "mount-192.168.1.5.sh" on my desktop. When I double click it, it is opened with gedit.

                – BlueBird
                May 18 '11 at 10:28





                I created the file "mount-192.168.1.5.sh" on my desktop. When I double click it, it is opened with gedit.

                – BlueBird
                May 18 '11 at 10:28













                You have to create this sh file with executable priviliges anywhere, and create a launcher at your desktop, which points to this .sh file.

                – Iradrian
                May 18 '11 at 12:29





                You have to create this sh file with executable priviliges anywhere, and create a launcher at your desktop, which points to this .sh file.

                – Iradrian
                May 18 '11 at 12:29











                2














                You could even take it a step further and have autofs take care of the mounting for you. Since autofs doesn't work particularly well with SSH public key authentication (unless you want to create a passwordless key pair for the superuser), there are tools that allow you to use the user's SSH keys, ssh-agent and keychain:





                • autosshfs: per user SSHFS automount using user's SSH configuration


                • afuse: an automounter implemented with FUSE






                share|improve this answer






























                  2














                  You could even take it a step further and have autofs take care of the mounting for you. Since autofs doesn't work particularly well with SSH public key authentication (unless you want to create a passwordless key pair for the superuser), there are tools that allow you to use the user's SSH keys, ssh-agent and keychain:





                  • autosshfs: per user SSHFS automount using user's SSH configuration


                  • afuse: an automounter implemented with FUSE






                  share|improve this answer




























                    2












                    2








                    2







                    You could even take it a step further and have autofs take care of the mounting for you. Since autofs doesn't work particularly well with SSH public key authentication (unless you want to create a passwordless key pair for the superuser), there are tools that allow you to use the user's SSH keys, ssh-agent and keychain:





                    • autosshfs: per user SSHFS automount using user's SSH configuration


                    • afuse: an automounter implemented with FUSE






                    share|improve this answer















                    You could even take it a step further and have autofs take care of the mounting for you. Since autofs doesn't work particularly well with SSH public key authentication (unless you want to create a passwordless key pair for the superuser), there are tools that allow you to use the user's SSH keys, ssh-agent and keychain:





                    • autosshfs: per user SSHFS automount using user's SSH configuration


                    • afuse: an automounter implemented with FUSE







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Jul 22 '17 at 20:22









                    Boris

                    30038




                    30038










                    answered Aug 21 '13 at 23:49









                    kynankynan

                    1,68011723




                    1,68011723























                        0














                        I mount a folder the exact same way, what i did was create a custom launcher that points to a .sh file that contains the command. Just make sure the file has execution permission and you're good to go.



                        I just click on the launcher:



                        enter image description here






                        share|improve this answer




























                          0














                          I mount a folder the exact same way, what i did was create a custom launcher that points to a .sh file that contains the command. Just make sure the file has execution permission and you're good to go.



                          I just click on the launcher:



                          enter image description here






                          share|improve this answer


























                            0












                            0








                            0







                            I mount a folder the exact same way, what i did was create a custom launcher that points to a .sh file that contains the command. Just make sure the file has execution permission and you're good to go.



                            I just click on the launcher:



                            enter image description here






                            share|improve this answer













                            I mount a folder the exact same way, what i did was create a custom launcher that points to a .sh file that contains the command. Just make sure the file has execution permission and you're good to go.



                            I just click on the launcher:



                            enter image description here







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered May 17 '11 at 14:58









                            amosriveraamosrivera

                            4564720




                            4564720























                                0














                                I tried to use cron to automatically mount ssh directory, but it causes an error saying Network is unreachable. It is because the cron job execution is too early to establish ip connections. After I inserted sleep before the sshfs command, it successfully mount the ssh directory.



                                sleep 5 && sshfs ......


                                So I made this script to fulfill my requirement.



                                #! /bin/sh
                                while true
                                do
                                ping -c1 -w1 ssh_server_ip > /dev/null && break
                                done
                                sshfs -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 sshname:/mountpath /localmountpath





                                share|improve this answer




























                                  0














                                  I tried to use cron to automatically mount ssh directory, but it causes an error saying Network is unreachable. It is because the cron job execution is too early to establish ip connections. After I inserted sleep before the sshfs command, it successfully mount the ssh directory.



                                  sleep 5 && sshfs ......


                                  So I made this script to fulfill my requirement.



                                  #! /bin/sh
                                  while true
                                  do
                                  ping -c1 -w1 ssh_server_ip > /dev/null && break
                                  done
                                  sshfs -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 sshname:/mountpath /localmountpath





                                  share|improve this answer


























                                    0












                                    0








                                    0







                                    I tried to use cron to automatically mount ssh directory, but it causes an error saying Network is unreachable. It is because the cron job execution is too early to establish ip connections. After I inserted sleep before the sshfs command, it successfully mount the ssh directory.



                                    sleep 5 && sshfs ......


                                    So I made this script to fulfill my requirement.



                                    #! /bin/sh
                                    while true
                                    do
                                    ping -c1 -w1 ssh_server_ip > /dev/null && break
                                    done
                                    sshfs -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 sshname:/mountpath /localmountpath





                                    share|improve this answer













                                    I tried to use cron to automatically mount ssh directory, but it causes an error saying Network is unreachable. It is because the cron job execution is too early to establish ip connections. After I inserted sleep before the sshfs command, it successfully mount the ssh directory.



                                    sleep 5 && sshfs ......


                                    So I made this script to fulfill my requirement.



                                    #! /bin/sh
                                    while true
                                    do
                                    ping -c1 -w1 ssh_server_ip > /dev/null && break
                                    done
                                    sshfs -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 sshname:/mountpath /localmountpath






                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Jan 17 at 9:42









                                    fx-kirinfx-kirin

                                    1438




                                    1438






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Ask Ubuntu!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f43363%2fhow-to-auto-mount-using-sshfs%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

                                        How to change which sound is reproduced for terminal bell?

                                        Can I use Tabulator js library in my java Spring + Thymeleaf project?