RPi3 Permissions

Bill Arnold

1974
Staff member
Messages
8,633
Location
Thomasville, GA
OK . . . I'm confused (as usual). :) Yes, I've read RPi forum entries, etc., but . . .

I've had trouble running applications I've installed on my RPi. There's no issue installing, but various things happen along the way. The most frequent is "Permission Denied", etc.

Reading about setting permissions, it seems an easy task. Since I'm the only user, is there any reason I shouldn't be able to set a global condition allowing me to run, edit, save anything?
 
I'm going to guess that it has something to do with the difference between the 'root' user and your user account.

The root user is like the super administrator that can do anything. You really don't want to run your user account with all that power.

But there are various times, such as installing programs, finding files, where you need to temporarily have that power.

So you can use the 'sudo' command. Sudo will run the command after it as if it was the root user.
 
I've used 'sudo' on installations when it calls for it. When a command fails, I'll try again with 'sudo' preceding it; sometimes that works, other times not.

As I continue to research some of the issues, it seems there is no definitive process for installing CNCjs, bCNC or UGS. I follow the instructions, get errors, investigate a bit more and find information such as: 'you might need blah, blah, blah, etc.' If there is a pre-requisite for certain files or folders, it seems that should be outlined in the instructions.
 
Yeah, The different versions of the operating system can all have different flavors of things you have to do. It can sometimes be a bit of a google fest to get those things working. I can't tell you how much time I've soaked into various projects because the one library I might want to use doesn't work with some version of some other library, or you have to use a particular older version. Oof.
 
Unix file permissions in a nutshell:

Each file has an owner and a group assigned to it.
To change this you use the "chown" and "chgrp" programs - respectively "chown user file" and "chgrp group file" (also true for directories)

Each file has four permission bytes, special bits, user, group, and world
The special byte is comprised of three values: set user ID (4) and set group ID (2) and restricted deletion or sticky (1) attributes.
Each of the user/group/world permissions are comprised of three values: read (4), write (2), and execute (1) - this is also true for directories except "execute" means "can list the directory"

You compose the permission set for a file by adding the bits you want on for each set together and then concatenating the values. In order to "execute" a file you also have to be able to read it.

You mostly don't have to/don't want to mess with the special permissions unless its something special. Most commonly those are used where you need to use the "set user ID" bit, this causes the program to run as the user that owns the file (so if the file is owned by "root" with setuid on and you run it as jimmybob it actually changes permission to run as root). This is useful if, for example, there are special system resources (aka a device driver interface) that are only accessible as a special user (usually root).

Examples:
  • no special bits, file owner can read/write/execute, file group can read/execute, world can read/execute: 0755
  • No special bits, owner can read/write, group can read, everyone can read: 0644
  • Program runs as file owner, file owner can read/write/execute, file group can read/execute, world can read/execute: 4755
 
Yeah, The different versions of the operating system can all have different flavors of things you have to do. ...

As I have researched different aspects of what I'm doing, I find what appear to be opposing instructions, but each is based on a particular version. My latest effort has been after installing a clean SD card with Raspbian Full.


Unix file permissions in a nutshell: ...

Thanks, Ryan. I understand the permissions from that standpoint. I've set permissions of a folder using the -R to include files within the folder as well as setting individual files.
 
Top