Permission denied??

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
digitalstone
Posts: 342
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Permission denied??

Post by digitalstone » 28 Dec 2017 14:49

I'm using the "init variable text file" to read the charging battery current at:
/sys/class/power_supply/battery/current_now

Whenever i execute it says "permission denied".

I'm using a rooted Nexus 5X - Vanilla Android
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Permission denied??

Post by Desmanto » 28 Dec 2017 15:45

That won't work, as general action of init and several files related operation are executed under normal user permission.
To access any file within root user permission, you must always use execute root command. (which mean we must know the command line alternatives)

To init the value of the current, use execute root command

Code: Select all

cat sys/class/power_supply/battery/current_now
check the {stdout} for the value.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
digitalstone
Posts: 342
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Re: Permission denied??

Post by digitalstone » 28 Dec 2017 18:00

Desmanto wrote:That won't work, as general action of init and several files related operation are executed under normal user permission.
To access any file within root user permission, you must always use execute root command. (which mean we must know the command line alternatives)

To init the value of the current, use execute root command

Code: Select all

cat sys/class/power_supply/battery/current_now
check the {stdout} for the value.
Oh boy, i'm a Linux noob so i know why i didn't feel this one out.
But thanks a bunch. It works now.

Little question though, i know of 'su' being used for interpreting super user commands.
But what does 'cat' stand for (other than your thumbnail :D )
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Permission denied??

Post by Desmanto » 29 Dec 2017 01:59

I am not quite familiar with linux too. Was forced to learn it bit by bit because of android. Most of the time I just google out the command using "android terminal" keyword. For example this cat command was found using "android terminal show file content"

cat command came from "concatenate" (some may say "catenate"). It supposed to be used to concatenate several files at once, and show them at the standard output. But somehow nowadays it usually used to show the content of a file.

Hehehe :D , this cat has been my avatar since I active in other forum. It is easier for others to spot my post. (they said so) So i just kinda make it as my unique signature.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
digitalstone
Posts: 342
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Re: Permission denied??

Post by digitalstone » 31 Dec 2017 19:12

Desmanto wrote:I am not quite familiar with linux too. Was forced to learn it bit by bit because of android. Most of the time I just google out the command using "android terminal" keyword. For example this cat command was found using "android terminal show file content"

cat command came from "concatenate" (some may say "catenate"). It supposed to be used to concatenate several files at once, and show them at the standard output. But somehow nowadays it usually used to show the content of a file.

Hehehe :D , this cat has been my avatar since I active in other forum. It is easier for others to spot my post. (they said so) So i just kinda make it as my unique signature.
Sorry for the late reply. But alright, so it's just "on of these things" that you just have to know :)

New years eve has arrived, so with this i wish best of luck going through 2018 to you + cat (if yours) and anyone who reads this in 2017 (no time machine from future allowed).
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

Post Reply