Create a MAP NETWORK DRIVE on TumbleWeed

I have been using this guide on Ubuntu for years
https://ubuntuhandbook.org/index.php/2014/08/map-network-drive-onto-ubuntu-14-04/

I want to Map a network drive under the Media folder.

can anyone help me with this on OpenSuse Tumbleweed.

There are more than one way to do this but I prefer systemd method;

Create a file called /etc/systemd/system/media.myfolder.mount


[Unit]
Description=Cool description of my mounted share


[Mount]
What=//IP.OR.HOSTNAME.OF.SHARE/SHARENAME
Where=/media/myfolder
Options=user=USERNAME,password=PASSWORD,gid=USERS,uid=MYLINUXUSERNAME,vers=3.0,_netdev,file_mode=0664,dir_mode=0775
Type=cifs
TimeoutSec=15


[Install]
WantedBy=multi-user.target

To explain things;

  • What → Is where the mount lives, for example //windowspc/share
  • Where → Where you want to mount it, note that in systemd the mount file has to be named like the folder ( for example if you mount it to /nas/coolfolder, the systemd .mount has to be named nas.coolfolder.mount )
  • Options → replace USERNAME and PASSWORD with the required user/pass to access the mount. UID = your Linux username

Once you have adjusted everything, you can simply issue; systemctl daemon-reload followed by **systemctl start your.cool.mount

**An even neater trick is that systemd can automount the folder when you enter it, if you create a filed in /etc/systemd/system/media.myfolder.automount with the contents:


[Unit]
Description=Some cool description


[Automount]
Where=/media/myfolder


[Install]
WantedBy=multi-user.target

This may sound very complex but once you get the hang of it, it becomes incredibly useful.

@Miuku

Thank you for the reply.

I am more of a copy paste linux user.

Your first instruction was to create a file
How do I go about it ?

sudo gedit /etc…
sudo zypper gedit /etc…

Thanks

JD

The following steps, I was able to do in a superuser terminal:
I created a Folder in Media

sudo mkdir /Media/HPS 
```html


and ran the following 

```html
gedit /etc/systemd/system/media.HPS.automount

And I added the following in the file and saved:

[Unit]
Description=HerculeServer

[Mount]
What=smb://192.168.1.104/HPS
Where=/Media/HPS
Options=user=admin,password=xxxx,gid=USERS,uid=abc,vers=3.0,_netdev,file_mode=0664,dir_mode=0775
Type=cifs
TimeoutSec=15


[Install]
WantedBy=multi-user.target

And I ran the following

systemctl daemon-reload

and

systemctl start media.HPS.mount

And I have restarted.
What am I doing wrong.

If these are the exact names you have used probably

systemctl start media.HPS.**auto**mount

is more suitable.