You are not logged in.

#1 2016-09-28 00:53:49

NakeSnakeater
Member
Registered: 2016-09-28
Posts: 12

Reset permissions - Undoing Chmod 757

Hi there,

So i was trying to fix a bug while installing some software, and i got tired of using the terminal running the sudo commands to write the files, so i made a big mistake by changing the permissions of some of the directories i was working on by executing this command line :

 sudo chmod 757 -R 

When i took 2 mins of my time to actually read what this command was doing i was really upset.

After reboot a lot of my features were messed up, like my web browser, no network was detected anymore, and on top of that i couldn't use sudo commands.

Then i tried to find a way to undo those stupid permisssions i've changed by doing so :

 for i in `pacman -Q | cut -f1 -d " "` ; do pacman -S --noconfirm "$i" ; done 

After that pretty much everything was back to normal, but i tried to install a "random" package from the aur and i still got those warning/error messages :

 warning: directory permissions differ on /XX
filesystem: 757  package: 755
warning: directory permissions differ on /XX
filesystem: 757  package: 755
warning: directory permissions differ on /XX
filesystem: 757  package: 755 

For security reasons i prefer no to show which directories are concerned, but if i'm wrong feel free to objectify.

So here am i, trying to find a way to set all my directories back to normal security level.

Do you have any idea on how to do that effectively ?

Thanks a lot and have a good day !

Offline

#2 2016-09-28 01:09:13

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

Re: Reset permissions - Undoing Chmod 757

It sounds like you fixed everything well, but note that `pacman -Q | cut ...` is a bit odd, you should use `pacman -Qq` for the same result.

There is no security issue in saying which directories those where from the filesystem package - we all have the same directories on our system.  You could just reset those to be 755 as they are supposed to be.

Also while you recognize it was a mistake to do this specific change recursively, you should learn a bit about permissions as 757 really doesn't make much sense for *any* file.  Having higher permissions for "others" than for "group" just doesn't really make any sense.


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

Offline

#3 2016-09-28 01:19:56

NakeSnakeater
Member
Registered: 2016-09-28
Posts: 12

Re: Reset permissions - Undoing Chmod 757

Yeah, it was really idiotic from me, but something i don't really get about arch, is that even when i set myself as a root user in the /etc/sudoers it still doesn't allow me to access certain files or change some settings.

I will certainly get into that group/permission wiki really soon, thanks for the quick support !

PS: Is there any way to list every single directory that is set in a specific security level ?
For instance if i want to see all the directories that are set to 757 so i don't forget any, while reseting them.

Last edited by NakeSnakeater (2016-09-28 01:30:15)

Offline

#4 2016-09-28 01:23:59

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

Re: Reset permissions - Undoing Chmod 757

NakeSnakeater wrote:

even when i set myself as a root user in the /etc/pacman.conf it still doesn't allow me to access certain files or change some settings

Erm ... what?  That doesn't make any sense at all.  This is not what pacman.conf is for.  What did you do in pacman.conf that you think should have this effect?

NakeSnakeater wrote:

Is there any way to list every single directory that is set in a specific security level

Yes. `man find` search for permissions.


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

Offline

#5 2016-09-28 01:30:27

NakeSnakeater
Member
Registered: 2016-09-28
Posts: 12

Re: Reset permissions - Undoing Chmod 757

Indeed it doesn't corrected it !

Offline

#6 2016-09-28 01:33:52

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

Re: Reset permissions - Undoing Chmod 757

Your correction makes a bit more sense - but still not a lot.  You cannot set yourself as root in sudoers.  You can add your user (or more commonly the wheel group) to be able to run commands with sudo.

This lack of precision in describing the situation makes it very hard to provide advice.  I suspect it is a similar lack of precision that leads to your problems.  Computers will not try to interpret what you really mean when you enter a command, they will just execute the command you give.

How have you edited sudoers?  What commands fail due to permissions leading to your observation that you can't access some files or settings?  What files or settings?


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

Offline

#7 2016-09-28 01:44:43

NakeSnakeater
Member
Registered: 2016-09-28
Posts: 12

Re: Reset permissions - Undoing Chmod 757

That's what i suspected, i just gave myselfs the right to use Sudo by adding a line to the user spec.

## User privilege specification
##
root ALL=(ALL) ALL
myusername ALL=(ALL) ALL

I guess that if i want to get full root rights, i need to add myself to the root group something along those lines.

Thanks for all your help, i think i can learn the rest through the wiki smile

Have a wonderful day/night

Offline

#8 2016-09-28 02:10:42

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,198

Re: Reset permissions - Undoing Chmod 757

NakeSnakeater wrote:

I guess that if i want to get full root rights, i need to add myself to the root group something along those lines.

No. Really, you definitely do NOT want to do this. If you are in group wheel, you are already in root's group, insofar as this makes any sense. But, really you should read up on users/groups/permissions before you make further trouble for yourself.

The point of having a separate root account is precisely that you do NOT want root privileges the vast majority of the time.

Last edited by cfr (2016-09-28 02:11:10)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#9 2016-09-28 06:00:16

NakeSnakeater
Member
Registered: 2016-09-28
Posts: 12

Re: Reset permissions - Undoing Chmod 757

I take note of that thanks for the advise, but don't worry i never thought of setting the groups before reading the wikis.

Offline

Board footer

Powered by FluxBB