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.
Best Answer
You could create a launcher and add it to your launcher bar by drag&dropping the
.desktop
-file there:Suggestion - even less work:
If you want even less work (=autoconnect) and a graphical user interface, you might want to check out Gigolo . It has the capability of auto-mounting a bookmark, whenever the bookmarked filesystem is present. You might want to check that out.
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:
Shell way
Another solution would be to put the following line in your crontab (edit
/etc/crontab
with sudo privileges):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).