udara
Posts: 50
Joined: Fri Jul 11, 2014 3:27 pm

How To Change Access Permission of a File In boot Folder.

Wed Oct 01, 2014 12:35 pm

I have a .conf file in 'boot' folder and I want to read it and get data from it, also I want to modify it and save it. Data reading part is working but the problem is my python programme cannot edit .conf file because of permission issue. When I use

Code: Select all

sudo python code.py
it works correctly. I want to know is there any way to change permissions or owner ship of a file in a 'boot' folder. I tried

Code: Select all

sudo chmod 777 code.py
but it didn't work.
Thanks.

elatllat
Posts: 1337
Joined: Sat Dec 17, 2011 5:05 pm

Re: How To Change Access Permission of a File In boot Folder

Wed Oct 01, 2014 1:55 pm

Code: Select all

mount | grep boot
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
1) vfat has no support for access permissions.
2) boot is not a place to put your python files try opt.
SBC with 32GB RAM: https://hardkernel.com

FAQ : https://raspberrypi.stackexchange.com

Unanswered: https://www.raspberrypi.org/forums/search.php?search_id=unanswered

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: How To Change Access Permission of a File In boot Folder

Wed Oct 01, 2014 2:52 pm

Reading between the lines, I'm assuming the reason OP wants to put stuff in /boot is so that he can take the SD card, stick it in a Windows machine, and be able to get the data.

There are (almost) always better ways to do this sort of operation, but if the OP wants that, then he wants that. Quoting that adroit sage Woody Allen, the heart wants what it wants.

Anyway, you can probably do this by either:
  • 1) Do "man mount" and figure out the mount incantation needed to set the default mode on a mount. Edit /etc/fstab accordingly, to make everything in /boot world-writable.

    2) Write a server process that runs as root and have your program feed data to that process which the writes the file in /boot. Not trivial, but do-able.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

elatllat
Posts: 1337
Joined: Sat Dec 17, 2011 5:05 pm

Re: How To Change Access Permission of a File In boot Folder

Thu Oct 02, 2014 2:45 am

Joe Schmoe wrote:...SD card, stick it in a Windows...
If the OP wants that they should just use an app to r/w ext4 on windows(Ext2IFS, Ext2Fsd, DiskInternals Linux Reader, Ext2explore, ExtFS for Windows, Ext2Read).

or just use winscp.
SBC with 32GB RAM: https://hardkernel.com

FAQ : https://raspberrypi.stackexchange.com

Unanswered: https://www.raspberrypi.org/forums/search.php?search_id=unanswered

udara
Posts: 50
Joined: Fri Jul 11, 2014 3:27 pm

Re: How To Change Access Permission of a File In boot Folder

Thu Oct 02, 2014 4:39 am

Thanks for replies,
My idea is as "Joe Schmoe" says anyone can easily access that .conf file in windows and change settings according to them. Conf file is in

Code: Select all

/boot/configuration.conf
and python programme is in

Code: Select all

/home/pi/App/code.py
It seems changing permission of .conf file in boot folder also not possible

Code: Select all

sudo chmod 777 configuration.conf
I will check your first option to make all files writable in boot folder.
Thanks.

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: How To Change Access Permission of a File In boot Folder

Thu Oct 02, 2014 8:09 am

The /boot folder is the redirected FAT partition, and since FAT doesn't do permissions or ownership its something of a none starter.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: How To Change Access Permission of a File In boot Folder

Thu Oct 02, 2014 8:46 am

pluggy wrote:The /boot folder is the redirected FAT partition, and since FAT doesn't do permissions or ownership its something of a none starter.

Code: Select all

pi@raspberrypi ~ $ sudo bash
root@raspberrypi:/home/pi# umount /boot;mount -o uid=pi /dev/mmcblk0p1 /boot
root@raspberrypi:/home/pi# ls -lsa /boot
total 9808
  16 drwxr-xr-x  2 pi   root   16384 Dec 31  1969 .
   4 drwxr-xr-x 22 root root    4096 Sep 20 21:40 ..
  18 -rwxr-xr-x  1 pi   root   17840 Sep  8 16:24 bootcode.bin
   2 -rwxr-xr-x  1 pi   root     115 Sep 20 21:00 cmdline.txt
   2 -rwxr-xr-x  1 pi   root    1312 Sep  8 17:26 config.txt
   4 -rwxr-xr-x  1 pi   root    2324 Sep  8 16:24 fixup_cd.dat
   6 -rwxr-xr-x  1 pi   root    6115 Sep  8 16:24 fixup.dat
  10 -rwxr-xr-x  1 pi   root    9166 Sep  8 16:24 fixup_x.dat
   2 -rwxr-xr-x  1 pi   root     137 Sep  9 05:10 issue.txt
3158 -rwxr-xr-x  1 pi   root 3232856 Sep  8 16:24 kernel.img
  20 -rwxr-xr-x  1 pi   root   18974 Sep 25  2013 LICENSE.oracle
 522 -rwxr-xr-x  1 pi   root  533080 Sep  8 16:24 start_cd.elf
2554 -rwxr-xr-x  1 pi   root 2615064 Sep  8 16:24 start.elf
3490 -rwxr-xr-x  1 pi   root 3572200 Sep  8 16:24 start_x.elf
root@raspberrypi:/home/pi# exit
pi@raspberrypi ~ $ touch /boot/foobar
pi@raspberrypi ~ $ rm /boot/footer
pi@raspberrypi ~ $ 
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: How To Change Access Permission of a File In boot Folder

Thu Oct 02, 2014 8:52 am

Try a chmod or chown and it illustrates the depths of the illusion.... ;)
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: How To Change Access Permission of a File In boot Folder

Thu Oct 02, 2014 9:20 pm

pluggy wrote:Try a chmod or chown and it illustrates the depths of the illusion.... ;)
You seem to be suggesting that I am claiming that using said mount option somehow magically changes it into a full Unix filesystem with Unix filesystem semantics.

Such is not the case (of course). In other news, water is wet.

But it does accomplish the goal of making it possible to create, write to, and delete files on the filesystem as user pi - without needing to be root.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

ermockler
Posts: 2
Joined: Sun Nov 25, 2018 7:55 pm

Re: How To Change Access Permission of a File In boot Folder.

Wed Jan 29, 2020 12:18 am

You could write the files to the pi system, and call a bash command as sudo to copy them to /boot.

drgeoff
Posts: 10765
Joined: Wed Jan 25, 2012 6:39 pm

Re: How To Change Access Permission of a File In boot Folder.

Wed Jan 29, 2020 12:52 am

ermockler wrote:
Wed Jan 29, 2020 12:18 am
You could write the files to the pi system, and call a bash command as sudo to copy them to /boot.
@Rip van Winkle (aka ermockler)
5 years have passed.

Return to “Beginners”