You are not logged in.

#1 2022-08-03 18:30:00

Asbestbrezel
Member
Registered: 2014-07-27
Posts: 67

reset all file-permissions to default

Hello guys,
a few updates ago i got this error message:

warning: directory permissions differ on /usr/share/hplip/base/pexpect/__pycache__/ filesystem: 777  package: 755

probably i could just change that specific directory to 755 manually. but i ask myself, if i could just check my entire system for some "wrong" chmod-settings and maybe i could just reset everything to default.

is that possible?

Last edited by Asbestbrezel (2022-08-03 18:30:36)

Offline

#2 2022-08-03 18:36:15

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,480
Website

Re: reset all file-permissions to default

You can check with (variations of) `pacman -Qk`.  But that message clearly calls it a "warning" it's not an "error" - there's nothing to be fixed.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2022-08-03 19:57:12

Asbestbrezel
Member
Registered: 2014-07-27
Posts: 67

Re: reset all file-permissions to default

that is a question that goes around in mind since i started using Linux. What is the right permission for every file. If i search for 777 files i find a lot, not only in home directory. But how can i know, that this is the correct?
I am not so into internet security and hacking stuff, but i guess if i change for example /etc/systemd/* to 777 it could open my system to hackers?

So it should be possible to check the system, if permissions are allright, shouldn't it?

Offline

#4 2022-08-03 20:25:37

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,494

Re: reset all file-permissions to default

What is the right permission for every file.

The one you need, this is borderline subjective and relates to questions about the owner of the file and whether you want it to be executable etc.

if i change for example /etc/systemd/* to 777

then you don't understand what you're doing. Why would you make any file in /etc executable?
Also

it cwould open my system to hackers

if you give anybody writing access to /etc/systemd/system, yes.

So it should be possible to check the system, if permissions are allright, shouldn't it?

Start w/ the one in the OP

warning: directory permissions differ on /usr/share/hplip/base/pexpect/__pycache__/ filesystem: 777  package: 755

What does that mean, what are the implications and what might have caused this?
Yes, the problem is defining "allright".

As Trilby pointed out "pacman -Qkk" will allow you to check the permissions of the files controlled by the package manager against their supposed condition.
You then have to estimate whether deviations are desired/necessary/sensible.

For all other files, "find" allows you to search by ownership and permissions, but you'll have to look for suspicious files (eg. not root owned or world writable files in /etc) and make the same estimation about what that means.

Online

#5 2022-08-03 23:11:44

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,480
Website

Re: reset all file-permissions to default

Asbestbrezel (emphasis added) wrote:

What is the right permission for every file. If i search for 777 files i find a lot ...

Well that's completely different from your initial question which was a warning about a directory.  Permissions of 0777 on a directory is not that odd or concerning, but on a file it could be a very different story.  You say you have found "a lot" of these... what are they?

EDIT: as indicated below, 0777 is typical of symlinks, but otherwise should not likely be used for any actual files.

Last edited by Trilby (2022-08-04 13:22:36)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2022-08-04 12:50:16

sekret
Member
Registered: 2013-07-22
Posts: 308

Re: reset all file-permissions to default

Could all those files with 777 be symlinks?

Offline

#7 2022-08-04 20:21:11

Asbestbrezel
Member
Registered: 2014-07-27
Posts: 67

Re: reset all file-permissions to default

yes, i guess, a lot my findings are directories or links.

i mean, i never changed the permission of system files or other root-owned files. but i thought, after i got that warning, that it could be a good idea, to ask if it is possible to check the entire system for possible wrong chmod-settings.

but, i guess, everything is allright. thank you guys for helping!

Last edited by Asbestbrezel (2022-08-04 20:21:37)

Offline

#8 2022-08-04 21:07:26

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,480
Website

Re: reset all file-permissions to default

It is possible, and it's a worthwhile thing to check if there is any suspicion.  The method to do so was in my initial reply in this thread - but this will only check package-owned files.

You say "a lot" of your findings are directories or links ... what does that mean?  Are all of them?  There typically should not be any regular file with 0777 permissions, and if there is one it's worth looking into.  Does the following command return any results?

find / -type f -perm 0777

"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2022-08-06 16:34:54

Asbestbrezel
Member
Registered: 2014-07-27
Posts: 67

Re: reset all file-permissions to default

that "-type f" is a good advice. i checked the system, no 777 files there, except in home directory.
is there an option to check for only the last digit, the public setting like 0**7 or 0**6?

Offline

#10 2022-08-06 17:25:13

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,480
Website

Re: reset all file-permissions to default

Yes there is.  Are your man pages broken?

Last edited by Trilby (2022-08-06 17:25:42)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB