Jump to content

orangepi zero plus "chown" permission change is not permanent


Siraj

Recommended Posts

I am changing the file/folder permission using chown  but is it not permanent

 

chown proxy:proxy a.log

 ls -l
total 0
-rw-r--r-- 1 proxy proxy 0 Apr 10 07:30 a.log

 

Now after some time that include reboot 

 

 ls -l
total 0
-rw-r--r-- 1 root root 0 Apr 10 07:30 a.log

 

I am using armbian on orange pi zero plus 

uname -r
5.4.14-sunxi64

 

 

Link to comment
Share on other sites

Hi Ramon,

 

This is actually a different problem, in that /sys (sysfs) is a virtual filesystem and not actually something on the SD card. In that sense, there's nothing to save boot-to-boot.

 

It's also a deprecated interface, so you may just want to look into the newer interface.

 

If you do want to use the GPIO that way, you can do one of a few things:

  • Make a script that configures your GPIO on every boot (such as rc.local)
  • Write a udev rule that sets ownership of gpio files in sysfs
  • Just run your application with setuid root privileges

 

Link to comment
Share on other sites

As a kick in the right direction, I have this in "/etc/udev/rules.d/50-gpio.rules".

KERNEL=="gpio*", GROUP="users"

 

Then need to trigger udev, or reboot. Afterwards ...

tparys@hobbes:~$ ls -l /dev/gpiochip*
crw-rw---- 1 root users 254, 0 Mar 20 20:58 /dev/gpiochip0
crw-rw---- 1 root users 254, 1 Mar 20 20:58 /dev/gpiochip1
crw-rw---- 1 root users 254, 2 Mar 20 20:58 /dev/gpiochip2
crw-rw---- 1 root users 254, 3 Mar 20 20:58 /dev/gpiochip3
crw-rw---- 1 root users 254, 4 Mar 20 20:58 /dev/gpiochip4

 

Then make sure gpiod is installed (sudo apt-get install gpiod). Then do something like this, or read man pages for gpioget / gpioset.

# Reading GPIO chip 1, line 3
gpioget 1 3

# Setting that GPIO to 1 (high
gpioset 1 3=1

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines