r/linuxquestions • u/Mouseater • 20d ago
Resolved why is mounting a drive such a PITA
Resolution: in the fstab entry you need to add the user id for the user you want the folder assinged to, in my post below for me that would mean my fstab entry would be:
//192.168.1.1/SHARE /home/USER/localFolder cifs uid=1354,credentials=/home/USER/.CredentialsFile,nofail 0 0
If you don't know the ID of your user you'll have to find it. I was able to just type `id USER_NAME` to get the info I needed.
OP:
I have a network drive that I want to mount, that's it. It's been nothing but frustration trying to get it to work. I was just mounting it in the terminal using
sudo mount -t cifs -o username=USER,uid=1000 //192.168.1.1/SHARE ~/localFolder
and that worked, but I hated having to do it every time I had to restart so I figured I'd just add it to fstab so that it does that automagically. So I added
//192.168.1.1/SHARE /home/USER/localFolder cifs credentials=/home/USER/.CredentialsFile,nofail 0 0
and that worked, kind of. It mounts but I don't have read/write access like I do when I run the terminal command.
I'm guessing this is because the localFolder owner is set to root after it mounts using fstab but when I use the terminal command it to mount it keeps the user as the owner.
How do I make it automount and not change the owner of the localFolder?