Automatically Mount network drive on boot up

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
vurtvurt

Automatically Mount network drive on boot up

Post by vurtvurt »

Hi,

I've only used windows in the past, this is my second day playing with Linux Mint. It all seems a bit strange right now.

Yesterday I found out how to map my network drive so PLEX can browse the contents under /media/Goflex by using this command in terminal:

sudo mount -t cifs "//192.168.0.11/GoFlex Home Public" /media/GoFlex -o username=xxxxx,password=xxxxx,uid=dan,vers=1.0

(the xxxxx represents my username and password)

Unfortunately i have to do this every time i re-boot my PC (going to be a plex server / home theatre pc)


Can I have this terminal command executed automatically each time I boot my PC so that PLEX can see the contents of the Goflex NAS drive without me having to manually do it?

Regards Dan
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
gm10

Re: Automatically Mount network drive on boot up

Post by gm10 »

Depends on whether you want to mount them at boot or only upon login of your user.

For the at boot see here:
https://wiki.ubuntu.com/MountWindowsSha ... rk_folders
This is slightly outdated but still looks ok at least in the section I linked (replace gedit with xed in that command)
altair4
Level 20
Level 20
Posts: 11453
Joined: Tue Feb 03, 2009 10:27 am

Re: Automatically Mount network drive on boot up

Post by altair4 »

This in a terminal:

Code: Select all

sudo mount -t cifs "//192.168.0.11/GoFlex Home Public" /media/GoFlex -o username=xxxxx,password=xxxxx,uid=dan,vers=1.0
Becomes this in /etc/fstab:

Code: Select all

//192.168.0.11/GoFlex\040Home\040Public /media/GoFlex cifs username=xxxxx,password=xxxxx,uid=dan,vers=1.0 0 0
It will mount at boot - maybe. THe network stack in Mint sometimes doesn't initialize in time for fstab execution. If that is the case with you an alternative would be this:

Code: Select all

//192.168.0.11/GoFlex\040Home\040Public /media/GoFlex cifs username=xxxxx,password=xxxxx,uid=dan,vers=1.0,noauto,user 0 0
That will not mount at boot but when used. For an explanation of what that means please see this: On Demand CIFS Mounting of Shares
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
vurtvurt

Re: Automatically Mount network drive on boot up

Post by vurtvurt »

Thanks you fo the prompt resonses I'll have a play with this.

PS i notice that PLEX cannot delete files when i use :
sudo mount -t cifs "//192.168.0.11/GoFlex Home Public" /media/GoFlex -o username=xxxxx,password=xxxxx,uid=dan,vers=1.0

if i change uid=dan to uid=plex then plex can delete but user dan cannot.

is there a way to do uid=dan&plex so that both plex and dan can delete files?
altair4
Level 20
Level 20
Posts: 11453
Joined: Tue Feb 03, 2009 10:27 am

Re: Automatically Mount network drive on boot up

Post by altair4 »

is there a way to do uid=dan&plex so that both plex and dan can delete files?
Sort of:

Make dan a member of the plex group - I'm guessing the plex group is "plex":

Code: Select all

sudo gpasswd -a dan plex
You will need to logoff and log back in again as dan in order for the group change to take affect.

Then change your mount command to this:

Code: Select all

sudo mount -t cifs "//192.168.0.11/GoFlex Home Public" /media/GoFlex -o username=xxxxx,password=xxxxx,uid=plex,gid=plex,dir_mode=0777,file_mode=0777,nounix,vers=1.0
Both plex and dan should have r/w access to the mount.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
vurtvurt

Re: Automatically Mount network drive on boot up [SOLVED]

Post by vurtvurt »

Thanks gents,

making dan a member of the plex group then adding gid=plex to the command worked. both plex and dan can delete. :)

also when i edited /etc/fstab

and added
//192.168.0.11/GoFlex\040Home\040Public /media/GoFlex cifs username=xxxxx,password=xxxxx,uid=plex,gid=plex,vers=1.0 0 0

this also worked on reboot. Now Plex is fully functional without me having to manually add commands :D

Much appreciated, might get into this linux malarky.

Cheers Dan
vurtvurt

Re: Automatically Mount network drive on boot up

Post by vurtvurt »

I'm having an issue with mounting drives.

I have my login user (dan) and two media server users plex and emby


I've added dan and emby to the plex group in terminal as follows:

sudo gpasswd -a dan plex
sudo gpasswd -a emby plex

If I user this command from terminal all is good (xxxxx represents user & password) :
sudo mount -t cifs "//192.168.0.11/GoFlex Home Public" /media/goflex -o username=xxxxx,password=xxxxx,uid=plex,gid=plex,dir_mode=0777,file_mode=0777,nounix,vers=1.0

I can read, write and delete media on the goflex nas drive as user dan
Also both media servers plex and emby can view and delete media, so this all works.


but this means I have to run the above command each time I boot the PC.



as a work around I use these commands in fstab :

//192.168.0.11/GoFlex\040Home\040Public /media/goflex cifs username=xxxxx,password=xxxxx,uid=plex,gid=plex,vers=1.0 0 0


//192.168.0.11/GoFlex\040Home\040Public /media/goflex2 cifs #username=xxxxx,password=xxxxx,uid=dan,gid=dan,vers=1.0 0 0

This automatically mounts goflex and goflex2 (same drive) plex can delete from goflex and dan can delete from goflex2 (but dan cannot delete from goflex) , I was thinking of making a goflex3 for emby.


Can the terminal command :
sudo mount -t cifs "//192.168.0.11/GoFlex Home Public" /media/goflex -o username=xxxxx,password=xxxxx,uid=plex,gid=plex,dir_mode=0777,file_mode=0777,nounix,vers=1.0

which makes goflex accessible (including delete) for the media servers and dan be converted for use in fstab? allowing dan,plex and emby to delete files in goflex without having to mount different drives for each user?

Regards
Dan





Best Regards
Dan
vurtvurt

Re: Automatically Mount network drive on boot up

Post by vurtvurt »

I used this command in the fstab

//192.168.0.11/GoFlex\040Home\040Public /media/goflex cifs username=xxxxx,password=xxxxx,uid=plex,gid=plex,rw,nounix,file_mode=0777,dir_mode=0777,vers=1.0 0 0

now emby, plex and dan can all read and delete files.
Locked

Return to “Beginner Questions”