Jakosaur
Posts: 6
Joined: Sun Mar 19, 2017 9:34 am

Can't write to NAS

Sun Mar 19, 2017 9:41 am

I've got my Raspberry Pi to run a Plex Media Server and I've got all my media stored on a NAS. I've edited /etc/fstab/ to mount the NAS to a directory on my Desktop and I can see all the files on my NAS.

Code: Select all

//192.168.1.2/PlexContent /home/pi/Desktop/MyBookLive cifs username=Plex,password=raspberry 0 0
I now need to be able to write to my NAS using my Raspberry Pi but I can't even create a folder. Just says Permission Denied. Any help would be appreciated! Thanks

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Can't write to NAS

Sun Mar 19, 2017 4:27 pm

Change it to

Code: Select all

//192.168.1.2/PlexContent /home/pi/Desktop/MyBookLive cifs uid=pi,gid=pi,username=Plex,password=raspberry 0 0
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Jakosaur
Posts: 6
Joined: Sun Mar 19, 2017 9:34 am

Re: Can't write to NAS

Mon Mar 20, 2017 11:29 am

DougieLawson wrote:Change it to

Code: Select all

//192.168.1.2/PlexContent /home/pi/Desktop/MyBookLive cifs uid=pi,gid=pi,username=Plex,password=raspberry 0 0
Thanks for the reply. I've changed it to that and now it isn't even mounting on boot.

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Can't write to NAS

Mon Mar 20, 2017 10:58 pm

You may need to put the numeric uid and gid values in the fstab line

awk -F":" '/pi/ {print "uid="$3",gid="$4}' /etc/passwd
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Jakosaur
Posts: 6
Joined: Sun Mar 19, 2017 9:34 am

Re: Can't write to NAS

Tue Mar 21, 2017 8:14 am

DougieLawson wrote:You may need to put the numeric uid and gid values in the fstab line

awk -F":" '/pi/ {print "uid="$3",gid="$4}' /etc/passwd
Thanks for that. Where would I put that line? Sorry, first time doing this.
Last edited by Jakosaur on Wed Mar 22, 2017 7:28 am, edited 1 time in total.

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Can't write to NAS

Tue Mar 21, 2017 9:45 am

Jakosaur wrote:Where abouts in the line would I put that?
that is a command line you are supposed to execute in terminal and it will open the file
/etc/passwd for you, find the line start with user name: pi
separate the line by all that ':' to find, give back the 3d and 4th occurrance in a nice to read/understand
uid= gid= text string.

so if you just do / execute in terminal / a
cat /etc/passwd
you can read the line for pi and find the 2 numbers you are supposed to use in your fstab line
like uid=1000,gid=1000

still need to thank @DougieLawson because making that line for you is quite some effort.

Jakosaur
Posts: 6
Joined: Sun Mar 19, 2017 9:34 am

Re: Can't write to NAS

Wed Mar 22, 2017 7:32 am

KLL wrote:
Jakosaur wrote:Where abouts in the line would I put that?
that is a command line you are supposed to execute in terminal and it will open the file
/etc/passwd for you, find the line start with user name: pi
separate the line by all that ':' to find, give back the 3d and 4th occurrance in a nice to read/understand
uid= gid= text string.

so if you just do / execute in terminal / a
cat /etc/passwd
you can read the line for pi and find the 2 numbers you are supposed to use in your fstab line
like uid=1000,gid=1000

still need to thank @DougieLawson because making that line for you is quite some effort.
Thanks for that explanation. The 2 numbers were both 1000 so I put them in my fstab line and it still doesn't mount on boot sadly.

Code: Select all

//192.168.1.2/PlexContent /home/pi/Desktop/MyBookLive cifs uid=1000,gid=1000,username=Plex,password=raspberry 0 0

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Can't write to NAS

Wed Mar 22, 2017 7:48 am

back to the original / working fstab line
Jakosaur wrote:I can see all the files on my NAS.

Code: Select all

//192.168.1.2/PlexContent /home/pi/Desktop/MyBookLive cifs username=Plex,password=raspberry 0 0
i have one question? sure the NAS has the password raspberry?
( because there should not be the RPI user pi password??? )

Jakosaur
Posts: 6
Joined: Sun Mar 19, 2017 9:34 am

Re: Can't write to NAS

Wed Mar 22, 2017 10:22 am

KLL wrote:back to the original / working fstab line
Jakosaur wrote:I can see all the files on my NAS.

Code: Select all

//192.168.1.2/PlexContent /home/pi/Desktop/MyBookLive cifs username=Plex,password=raspberry 0 0
i have one question? sure the NAS has the password raspberry?
( because there should not be the RPI user pi password??? )
Yes. I setup the account previously and can access the NAS via Windows using those credentials. For some reason now that original fstab line doesn't work.

I can manually mount the drive using

Code: Select all

sudo mount -t cifs -o username=Plex,password=raspberry //192.168.1.2/PlexContent /home/pi/Desktop/MyBookLive
Found that command line on another forum. Still doesn't give me write access. Not sure if that is any help but that seems to work. Just really want it to mount at boot.

Ernst
Posts: 1334
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Can't write to NAS

Wed Mar 22, 2017 11:10 am

This is what I have entered in the /etc/fstab:

Code: Select all

//raspi1/hdd1   /mnt/raspi1     cifs    user=pi,password='',x-systemd.automount  0 0
The road to insanity is paved with static ip addresses

Jakosaur
Posts: 6
Joined: Sun Mar 19, 2017 9:34 am

Re: Can't write to NAS

Wed Mar 22, 2017 2:45 pm

Ernst wrote:This is what I have entered in the /etc/fstab:

Code: Select all

//raspi1/hdd1   /mnt/raspi1     cifs    user=pi,password='',x-systemd.automount  0 0
Thanks for that. I've got it automatically mounting again using

Code: Select all

//192.168.1.2/PlexContent /home/pi/Desktop/NAS cifs username=Plex,password=raspberry,x-systemd.automount 0 0
I am mounting it to a different directory now. Any idea how to give write permissions as I just get 'permission denied' even when I am trying to make a directory?

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Can't write to NAS

Thu Mar 23, 2017 12:22 pm

You have to set the uid=1000 and gid=1000 on your mount. Simple.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Beginners”