Calibrating permissions

For interesting topics. But remember this is a Linux Forum. Do not post offensive topics that are meant to cause trouble with other members or are derogatory towards people of different genders, race, color, minors (this includes nudity and sex), politics or religion. Let's try to keep peace among the community and for visitors.

No spam on this or any other forums please! If you post advertisements on these forums, your account may be deleted.

Do not copy and paste entire or even up to half of someone else's words or articles into posts. Post only a few sentences or a paragraph and make sure to include a link back to original words or article. Otherwise it's copyright infringement.

You can talk about other distros here, but no MX bashing. You can email the developers of MX if you just want to say you dislike or hate MX.
Message
Author
Charlie Brown

Re: Calibrating permissions

#31 Post by Charlie Brown »

You can compare with those on live session.

Say, "open terminal here" (or first cd to that path) and:

Code: Select all

stat -c '%a %n' *
one by one (on live session) and have a look.


Or state the path and even save in a text file to inspect later :

i.e.

Code: Select all

stat -c '%a %n' .icons/* > Anyname.txt
(Anyname.txt will be in home folder, as you might already know you can state a path for it, too)


(Though this is not recursive)

Charlie Brown

Re: Calibrating permissions

#32 Post by Charlie Brown »

... Or, if you want it recursive and including everything in home folder, a crazy way:

Code: Select all

ls -laR > permissions.txt

Code: Select all

sed -i '/-rw-r--r--/d' permissions.txt

Code: Select all

sed -i '/drwxr-xr-x/d' permissions.txt
The 755 (for directories only) and 644 (for files only) lines will be deleted. It still has more than 20,000 lines but at least you can have a look scrolling if there's something very important to you ... (Do this on live session with a user terminal, no root sudo su etc..)

Jakob77
Posts: 658
Joined: Thu Feb 09, 2023 3:09 am

Re: Calibrating permissions

#33 Post by Jakob77 »

Thank you Charlie Brown, yes.
I have also made a copy of a new users home folder to a shared folder so I can compare.
And this command can maybe be helpful for log files:

Code: Select all

ls -lah
And it already shows it is much more complicated than I like.
I see you use the same and thank you for warning me before I use it and faint. ;-)



It suddenly hits my mind... :poke:





Jakob77 wrote: Thu Sep 21, 2023 10:58 am
Charlie Brown wrote: Tue Sep 19, 2023 5:52 pm
Jakob77 wrote: Tue Sep 19, 2023 4:47 pm...
And it has some different sub folders ... Do you think this looks like a correct syntax ...

Code: Select all

sudo chmod -x -R ~/Music/*.*
Yes, but no :D

If we do it in bulk, then, those which do not already have x (executable) may become problematic, new issues may occur.
I have to ask problematic how, what issues.?
Could it perhaps help to make them all +x first and then -x all.?
To me it looks like a big advantage if it is possible to reduce the edit to only the one privilege we want to change.

@DukeComposed

Can 'find' find only the files with permission to run like programs and chmod them '-x' .?

User avatar
DukeComposed
Posts: 1451
Joined: Thu Mar 16, 2023 1:57 pm

Re: Calibrating permissions

#34 Post by DukeComposed »

Jakob77 wrote: Sat Sep 23, 2023 5:54 pm Can 'find' find only the files with permission to run like programs and chmod them '-x' .?
As I said:
DukeComposed wrote: Wed Sep 20, 2023 7:17 pm Extra credit: find supports an "-exec" argument that can used to run a command on the files/directories it returns. It also supports a "-perm" argument I mentioned earlier, and "\!" can be used to negate the permissions check, i.e., "find dir -type d \! -perm 0755" should give a list of all directories and subdirectories that do not have mode 0755.
If you run "man find" it will give you a comprehensive list of options that find supports. Perhaps more importantly here, there is a section labeled "EXAMPLES" that can show you how to run find with the "-perm" argument to look only for files with a certain mode.

I found a useful illustrated guide to UNIX file permissions online, courtesy of the amazing Julia "b0rk" Evans: https://i.pinimg.com/originals/fb/65/0a ... 3fc608.jpg

That guide will explain what find is doing in this example:

Code: Select all

mkdir test
cd test
touch one two three four
chmod 0700 one
chmod 0770 two
chmod 0777 three
find . -type f -perm /111
./three
./one
./two
I also could've written it "find . -type f -perm /u=x,g=x,o=x", if that's easier to parse.

Jakob77
Posts: 658
Joined: Thu Feb 09, 2023 3:09 am

Re: Calibrating permissions

#35 Post by Jakob77 »

Thank you.



@Charlie Brown


In a new .thunderbird I find approximately 50 files with five different permissions:

700
777
755
644
600

I don't know how smart this syntax is but I think it gives a good output for further work if needed:

Code: Select all

find .  -printf "%m %f %g\n" | column -t
And the output I could spend a cosy time knitting with chmod for lines for the script something like this:

Code: Select all

chmod 644 ~/.thunderbird/profiles.ini
next file and so on..... this far it looks okay in theory.



However...

In my backup I find more than 2.000 files with only two different permissions:

777
755

There are a lot more files, different filenames and different folders.
And maybe some permissions are changed on purpose.


How am I ever going to be able to solve this correctly.?


Is it unfair to name it a security hole in Thunderbird and expect the Thunderbird developers to fix it.?

User avatar
Eadwine Rose
Administrator
Posts: 14888
Joined: Wed Jul 12, 2006 2:10 am

Re: Calibrating permissions

#36 Post by Eadwine Rose »

Jakob77 wrote: Sun Sep 24, 2023 6:52 pm Is it unfair to name it a security hole in Thunderbird and expect the Thunderbird developers to fix it.?


Report to the TB people if there is a TB problem.
MX-23.6_x64 July 31 2023 * 6.1.0-37amd64 ext4 Xfce 4.20.0 * 8-core AMD Ryzen 7 2700
Asus TUF B450-Plus Gaming UEFI * Asus GTX 1050 Ti Nvidia 535.247.01 * 2x16Gb DDR4 2666 Kingston HyperX Predator
Samsung 870EVO * Samsung S24D330 & P2250 * HP Envy 5030

User avatar
fehlix
Developer
Posts: 12760
Joined: Wed Apr 11, 2018 5:09 pm

Re: Calibrating permissions

#37 Post by fehlix »

Jakob77 wrote: Sun Sep 24, 2023 6:52 pm In a new .thunderbird I find approximately 50 files with five different permissions:

Is it unfair to name it a security hole in Thunderbird and expect the Thunderbird developers to fix it.?
Where do you see a "security hole"?
The top Thunderbird profile folder ".thunderbird" within users home
provides only access for the user (and root) for all files and folder underneath:

Code: Select all

ls -nd .thunderbird/
drwx------ 6 1000 1000 165 Sep 10 19:56 .thunderbird/
Suggest, to study a bit about access rights in rgrd to permissions and ownership in linux file systems.
HTH

Jakob77
Posts: 658
Joined: Thu Feb 09, 2023 3:09 am

Re: Calibrating permissions

#38 Post by Jakob77 »

fehlix

I hope there are more defense lines without holes than just that one.
I think it is about holding the fort and that takes more than one defense line.
If you let the fort full of Trojan horses without doing anything about it for years it is not really optimal for holding the fort. No good and no safety in that. It is just an extra unnecessary risk.

And maybe it is easy to put it right for those who knows the program.


Eadwine Rose wrote: Mon Sep 25, 2023 4:59 am
Jakob77 wrote: Sun Sep 24, 2023 6:52 pm Is it unfair to name it a security hole in Thunderbird and expect the Thunderbird developers to fix it.?
Report to the TB people if there is a TB problem.
I thought you had already done that. :-)
Do you know the best place to do it.?

User avatar
Eadwine Rose
Administrator
Posts: 14888
Joined: Wed Jul 12, 2006 2:10 am

Re: Calibrating permissions

#39 Post by Eadwine Rose »

Google :) Pretty sure you're smart enough to know where to find the place to report something on TB. :)
MX-23.6_x64 July 31 2023 * 6.1.0-37amd64 ext4 Xfce 4.20.0 * 8-core AMD Ryzen 7 2700
Asus TUF B450-Plus Gaming UEFI * Asus GTX 1050 Ti Nvidia 535.247.01 * 2x16Gb DDR4 2666 Kingston HyperX Predator
Samsung 870EVO * Samsung S24D330 & P2250 * HP Envy 5030

Jakob77
Posts: 658
Joined: Thu Feb 09, 2023 3:09 am

Re: Calibrating permissions

#40 Post by Jakob77 »

Yes, I can always do more.
It might just take a little longer. ;-)
If I am the only user being concerned it is also a logic consequence that the priority will be lowered.


~/Desktop and ~/.icons are already put in for advice on an external page:
https://forum.xfce.org/viewtopic.php?pid=73293#p73293

Locked

Return to “General”