LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-18-2003, 10:56 AM   #1
BroX
Member
 
Registered: Oct 2003
Location: Sweden
Distribution: Slackware64-current, SlackwareARM-15.0
Posts: 833

Rep: Reputation: 90
Unhappy Why is chmod a+r -R /usr/ a bad idea?


After installing Wine I only had normal fonts in the programs I ran with Wine when I logged in as root. Logged in as myself I got those horrible squares.

Thinking that this could be because the fonts couldn't be reached when logged in as user, I decided to give everyone permission to read from /usr/ (I am the only person using the laptop anyway so I figured 'nothing to lose'). So,

chmod a+r -R /usr/

NOT a good idea :-( Everything on my desktop disappeared!!

Why was this so bad?? Reading doesn't hurt? Or....?

Please o gurus, enlighten me :-)
 
Old 11-18-2003, 11:56 AM   #2
xode
Member
 
Registered: Aug 2003
Distribution: Mandrake 9.0; FC4; FC8; SUSE 10.3; SUSE 12.1; SUSE 13.2
Posts: 638
Blog Entries: 1

Rep: Reputation: 52
Quote:
Why is chmod a+r -R /usr/ a bad idea?
(1) "a+r" as a chmod argument? I personally don't like that style. I use exclusively octal when specifying the permissions that I give to chmod. There is no misunderstanding with octal. I encourage you to learn and use it.

(2) -R means recursive, which means that you altered the permissions of not only /usr itself but every file and every directory in /usr. Personally, I like to chmod only what I have in my sights, so to speek, the only exception being a collection of user data (e.g. a bunch of text files that I just copied over from a CDROM to a working directory on the hard drive) that I just acquired, that is currently in one specific harmless and out of the way spot and that needs to be altered as a unit. Especially, if I am root and I am working on the system, I will only change one item at a time and check things out after each change. It could be that, when you gave everything in /usr read permission to everyone, it was your system's security mechanisms that caused your problem, but that is a guess on my part. Obviously, you did create a problem.

Last edited by xode; 11-18-2003 at 12:15 PM.
 
Old 11-18-2003, 12:06 PM   #3
vasudevadas
Member
 
Registered: Jul 2003
Location: Bedford, UK
Distribution: Slackware 11.0, LFS 6.1
Posts: 519

Rep: Reputation: 30
chmod a+r <filename> is the relative form of the command. It means "grant read permission to all users on this file in addition to whatever other permissions are set". Similarly, chmod g-w <filename> would mean "remove write permission to all users in the same group on this file in addition to whatever other permissions are set".

The absolute octal form of the command is good, but I find this easier than working out the octal representations of the binary.

Dunno why this made everything on your [ljsbrokken] desktop disappear though.
 
Old 11-18-2003, 12:23 PM   #4
xode
Member
 
Registered: Aug 2003
Distribution: Mandrake 9.0; FC4; FC8; SUSE 10.3; SUSE 12.1; SUSE 13.2
Posts: 638
Blog Entries: 1

Rep: Reputation: 52
Binary to octal is a lead pipe cinch. Each group of 3 bits of the 9 bit permission that you want to give, beginning with the left 3 bits, gets replaced by whatever single octal digit that those 3 bits correspond to. Binary to octal mapping is as follows:

0 = 000
1 = 001
2 = 010
3 = 011
4 = 100
5 = 101
6 = 110
7 = 111

Incidentally, binary to hex is just as easy. The exact same mapping rules apply, except that it is 4 bits at a time that map to a hex digit.
 
Old 11-18-2003, 12:47 PM   #5
vasudevadas
Member
 
Registered: Jul 2003
Location: Bedford, UK
Distribution: Slackware 11.0, LFS 6.1
Posts: 519

Rep: Reputation: 30
Thanks (genuinely). I used to hack in machine code on my old Archimedes, so I'm quite familiar with binary and hex (and therefore octal too). My understanding is not the problem. My problem is laziness - I just can't be bothered to remember whether read permission is bit 0 or 2, and whether the user's permissions is the most significant nibble or whether that's all users, and I also can't be bothered to remember eight conversions from binary to octal (or decimal or hex - 'tis after all the same from 0 to 7!).

I can't stress enough - this is all my fault, pure laziness and no other reason. If I had to execute chmod commands frequently, I'm sure I'd remember, but I don't so I don't.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bad Idea dudeman41465 Linux - Software 1 10-10-2005 02:37 AM
TOMCAT: good or bad idea chadi Linux - General 3 11-02-2004 06:42 PM
Is this a good or bad idea? kemplej Linux - Software 2 10-26-2004 09:34 AM
Bad idea to add new sdram? silentwhispers Linux - Hardware 10 08-24-2004 08:51 PM
CHMOD in shell : chmod 777 /usr/ <---is that right? cpanelskindepot Programming 5 07-16-2004 05:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration