Score:1

Mounting (Bookmarking) remote directories over SSH via bash script?

td flag

I'm pretty unfamiliar with Ubuntu and Linux in general, but we have a LAN in our office that all talk to a remote box for storage. On the client systems, I have to open up the file explorer and select "Other Locations" and then issue the following in the prompt:

ssh://<user>@<host>

Once logged in, I then navigate to a particular directory and drag it over to the sidebar and select "Add Bookmark".

For some reason this unmounts on occasion and I wanted to write a bash script that I can just double click or run via the terminal to do all this. The boxes are all running Ubuntu 20.04 and do not have internet access; some libraries have been downloaded and available via sudo apt-install but not many.

Not sure where to start in terms of Ubuntu or Linux commands, more of a Windows user, so I don't have any "what have you tried" worthy material (plus I cannot copy it over here anyhow).

ar flag
Clicking on the bookmark should mount it again.
pstatix avatar
td flag
@user68186 Sometimes, but it would just be nice to run a script regardless, for setting up new boxes.
ar flag
AFAIK there is no way to script that would make a bookmark for you in Nautilus (AKA Files), but I may be wrong. Instead of `ssh://<user>@<host>` you may want to try `sftp://<user>@<host>/full/path/to/your/folder`. ssh and sftp use the same protocol. If you are using password, you may want to try private-public key pair instead.
ar flag
You may also want to take a look at [this question and its answers](https://askubuntu.com/questions/309347/cant-mount-sshfs-via-fstab-but-can-mount-via-cli-how-do-i-get-fstab-to-mount).
Score:2
dj flag

You can mount the remote file system over ssh using sshfs command, then interact with it as if it were a local system.

There is a man page here: https://linux.die.net/man/1/sshfs which gives the syntax for the command:

sshfs [user@]host:[dir] mountpoint [options]

Another tool in the wonderful ssh toolbox!

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.