Remote accessing server drives

Hello, everyone!

I have set up a home server, connected to two permanently mounted external drives as storage units. I want to give my computer access to those drives, from the file manager, much like the server access on Windows a LAN we all know. I managed to make symbolic links on my file manager to each of those drives through ssh, but the problem is that with every client reboot, I need to open up terminal, execute the script and insert the server password twice. I want to just have a shortcut in my file manager that automatically starts with my client’s boot every time, without the need to open a terminal, launch the script, insert password… how do I do that?

Thank you.

Hi @VicenteMMOS,

I have several network, more specifically SSH mountpoints that I access automagically without a password.

To do so, you’ll need SSH key-based authentication setup:

https://wiki.archlinux.org/title/SSH_keys

Combine that with:

and

Hope this helps!

1 Like

Hi, @Mirdarthos, thanks for the in-depth articles =)

I often come back to another post I made here in the forum, about a similar question, on how to mount the 2nd NVMe drive I have in my laptop. This time, the situation is slightly different, as in now there are 2 external drives, connected to the home server machine, which I want to access remotely (so that I can spare myself the hassle of having to bring them with me all the time, and always have to use one of my usb ports).

I had already set up an ssh key, even though I don’t really understand why I need it… I mean, so far, my ssh key is just allowing me to ssh connect to the server by just typing ssh server, instead of the entire ssh -p 22 hostname@ip_address. It’s just slightly more convenient, but I still need to open the terminal, type, and input my keyphrase in order to have ssh access to the server, not even to access the drives directly.

Anyway, I’ve followed the article you sent, on systemd mount unit samples, and made my own .automount files (which I’m assuming is what I should do, given the storage units are both external hard drives, right?). But I’m getting an error when trying to start the .automount service:

$ sudo systemctl start drives-Drive1.automount

Job failed. See "journalctl -xe" for details.

$ journalctl -xe

feb 28 17:46:00 macbook wpa_supplicant[816]: wlp3s0: WPA: Group rekeying completed with bc:cf:4f:1c:c7:00 [GTK=CCMP]
feb 28 17:46:00 macbook wpa_supplicant[816]: wlp3s0: WPA: Group rekeying completed with bc:cf:4f:1c:c7:00 [GTK=CCMP]
feb 28 17:46:20 macbook sudo[90375]: linuxlite : TTY=pts/0 ; PWD=/etc/systemd/system ; USER=root ; COMMAND=/usr/bin/systemctl start drives-Drive1.automount
feb 28 17:46:20 macbook sudo[90375]: pam_unix(sudo:session): session opened for user root(uid=0) by linuxlite(uid=1000)
feb 28 17:46:20 macbook systemd[1]: drives-Drive1.automount: Refusing to start, unit drives-Drive1.mount to trigger not loaded.
feb 28 17:46:20 macbook systemd[1]: Failed to set up automount Automount external drive 1.
░░ Subject: A start job for unit drives-Drive1.automount has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ A start job for unit drives-Drive1.automount has finished with a failure.
░░ 
░░ The job identifier is 16673 and the job result is failed.
feb 28 17:46:20 macbook sudo[90375]: pam_unix(sudo:session): session closed for user root
feb 28 17:51:52 macbook sudo[90412]: linuxlite : TTY=pts/0 ; PWD=/etc/systemd/system ; USER=root ; COMMAND=/usr/bin/systemctl start drives-Drive1.automount
feb 28 17:51:52 macbook sudo[90412]: pam_unix(sudo:session): session opened for user root(uid=0) by linuxlite(uid=1000)
feb 28 17:51:52 macbook systemd[1]: drives-Drive1.automount: Refusing to start, unit drives-Drive1.mount to trigger not loaded.
feb 28 17:51:52 macbook systemd[1]: Failed to set up automount Automount external drive 1.
░░ Subject: A start job for unit drives-Drive1.automount has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ A start job for unit drives-Drive1.automount has finished with a failure.
░░ 
░░ The job identifier is 16677 and the job result is failed.
feb 28 17:51:52 macbook sudo[90412]: pam_unix(sudo:session): session closed for user root


Just for the sake of clarity, here’s one of the .automount scripts I made:

cat /etc/systemd/system/drives-Drive1.automount 
[Unit]
Description=Automount external drive 1

[Automount]
Where=/drives/Drive1
TimeoutIdleSec=5

[Install]
WantedBy=multi-user.target

and here are the folders I created in the server machine:

ls -l /drives/
total 8
drwxr-xr-x 2 linuxlite linuxlite 4096 feb 28 17:40 Drive1
drwxr-xr-x 2 linuxlite linuxlite 4096 feb 28 17:40 Drive2

I don’t really know what I’m missing here… can anyone help, please?