LinuxQuestions.org
Review your favorite Linux distribution.
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 09-26-2010, 03:25 AM   #16
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57

@ san

I found this article doing a google search.
You can read the rest of the article before committing to this.
http://www.cyberciti.biz/tips/reset-...ermission.html

Quote:
Reset the permissions of the all installed RPM packages

You need to use combination of rpm and a shell for loop command as follows:

for p in $(rpm -qa); do rpm --setperms $p; done
for p in $(rpm -qa); do rpm --setugids $p; done

Above command combination will reset all the permissions to the default permissions under CentOS / RHEL / Fedora Linux.

Last edited by dv502; 09-26-2010 at 03:35 AM.
 
Old 09-26-2010, 05:14 AM   #17
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by dv502 View Post
Code:
chmod -R 777 /var/www
If you have no other means of setting permissions then if you would want to do something like that it should be along the lines of doing 'find /var -type d -print0|xargs -0 -iD chmod 0755 'D'; find /var -type f -print0|xargs -0 -iF chmod 0644 'F';'.


Quote:
Originally Posted by san_to_all View Post
rpm --setperms filesystem-2.4.19-1.fc10.i386
and response was sh: -line 1: syntax error near unexpected token ')'
sh: -line 1: '[ -L '/'] || chmod t a number) '/''
Of course dv502's FUP post makes things easier but running 'rpm --setperms filesystem' should work (I'll not going into under-the-hood details about how this works) but in case it still doesn't work for you you can try the manual version of the same (an adaptation of this old post) but only addressing the filesystem package and nothing under /usr/(.*/)share:
Code:
chmod 0755 / /bin /bin/*sh* /bin/rpm /var /var/lib /var/lib/rpm; chmod 0644 /var/lib/rpm/*
rpm -q --dump filesystem | grep -v share/ | awk '{print $5, %1}' | while read MODE ENTITY; do
 MODE=${MODE:2:6}; echo "chmod ${MODE//207/07} ${ENTITY}"
done
Run and review the command, then remove the "echo" statement to execute.
* Whatever procedure you choose, after you're done running 'rpm -Vva|grep "^\.\{8\}";' should show any entities with other attributes to correct.
** While the reflex of re-installing from scratch may prove to be faster in some cases I hope this shows that it is not always necessary and also showcases the merits of using a mature, full-featured, easy-usable package management system.
 
Old 09-27-2010, 10:21 AM   #18
san_to_all
LQ Newbie
 
Registered: Sep 2010
Posts: 24

Original Poster
Rep: Reputation: 0
I tried first dv502 suggestion but it shows same error recursiverly with only directory name changed.
Then I tried unSpawn's suggestion but running command
-----------
chmod 0755 / /bin /bin/*sh* /bin/rpm /var /var/lib /var/lib/rpm; chmod 0644 /var/lib/rpm/*
rpm -q --dump filesystem | grep -v share/ | awk '{print $5, %1}' | while read MODE ENTITY; do
MODE=${MODE:2:6}; echo "chmod ${MODE//207/07} ${ENTITY}"
done
------------

showed the prompt like this
>
and waits for additional command.

Resetting file permissions seems to be not working. Can I copy my data directory into pendrive or send it to windows filesystem? because I am able to reach within that directory and could check the file size.
 
Old 09-27-2010, 02:08 PM   #19
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by san_to_all View Post
Resetting file permissions seems to be not working.
You can still quit after trying. Just don't right now.


Quote:
Originally Posted by san_to_all View Post
rpm -q --dump filesystem | grep -v share/ | awk '{print $5, %1}' | while read MODE ENTITY; do
Should be awk '{print $5, $1}', sorry.
 
Old 09-28-2010, 11:44 PM   #20
san_to_all
LQ Newbie
 
Registered: Sep 2010
Posts: 24

Original Poster
Rep: Reputation: 0
Hi, Unspawn
Just before your last post I tried
chmod 777 /
chmod 777 /var
chmod 777 /var/www

and linux started very well. I backed up my all data.
Only problem is that,it starts in single user mode, shutdown button is unavailable, windows filesystem and dvd drive is not mounting and few programs don't run saying insufficient file permissions.

-----------
I ran code from your last post.
rpm -q --dump filesystem | grep -v share/ | awk '{print $5, $1}' | while read MODE ENTITY; do
-------------

but it shows the same promt
>

----------------
There is no question of quiting when people like you and dv502 and lots of other Linux community people out there to help others!
 
Old 09-29-2010, 12:10 AM   #21
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57
Quote:
Originally Posted by san_to_all View Post
chmod 777 /

777 is a is insecure permission setting for a root filesystem. 755 would be a better choice.

Quote:
Originally Posted by san_to_all View Post
-----------
I ran code from your last post.
rpm -q --dump filesystem | grep -v share/ | awk '{print $5, $1}' | while read MODE ENTITY; do
-------------

but it shows the same promt
>
Did you ran the code exactly as above?

The code above is a line replacement. It is suppose to be run with the complete script that unSpawn gave you.

Last edited by dv502; 09-29-2010 at 12:55 AM.
 
Old 09-29-2010, 12:53 AM   #22
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,348

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
That was just a fix to a typo in the 1st line(!) of UnSpawn's post. The whole cmd must be run. It's basically a one-liner using a loop
eg

blah while blah do ....... done

HTH
 
Old 09-29-2010, 01:13 AM   #23
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57
That's why I ask if he had run the code that way, because it is wrong. It is a line replacement for the script.

What concerns me is he uses the permission setting of 777 for the root filesystem.

Just in case unSpawn's script doesn't work or runs into more errors and san_to_all doesn't want to re-install, or better yet upgrade to fedora 13, san_to_all should at least chmod the root filesystem to 755 which is more secure than 777.

Last edited by dv502; 09-29-2010 at 01:32 AM.
 
Old 09-29-2010, 11:36 PM   #24
san_to_all
LQ Newbie
 
Registered: Sep 2010
Posts: 24

Original Poster
Rep: Reputation: 0
Hi,
dv502
Yes it was my mistake, sorry for that.
Now I run the code with full script. When I run the code with echo command it shows all directory in root with permisstions.
-------------------
chmod 0755 /
chmod 0755 /bin
-------------------
And when I run code without echo command response was
-----------------
bash: chmod 0755 /: No such file or directory
bash: chmod 0755 /bin: No such file or directory
-----------------
(with all directory in root)

Then I tried as you said

chmod 755 /

command run successfully. But there is no change single user mode or other problem which I described in my last post.

I haven't started linux in single user mode now.
It was normal boot process.
 
Old 09-30-2010, 03:56 AM   #25
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57
In your last post, you said your system still starts at single user mode.

Can you look for a line in your /etc/inittab like below.

id:5:initdefault:

Depending on the distro, the number in bold can be 2,3 or 5.

If the number is 1, that is single user mode. You'll need to change it.

Here is an excerpt of my inittab file which describes the runlevels.

Note: Some linux distros will have their own runlevel system.

# Default runlevel. The runlevels used by PCLinuxOS are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:

I suggest you try with the number 5.

Last edited by dv502; 09-30-2010 at 04:00 AM.
 
Old 09-30-2010, 10:10 AM   #26
san_to_all
LQ Newbie
 
Registered: Sep 2010
Posts: 24

Original Poster
Rep: Reputation: 0
Yes it is same
id:5:initdefault:
 
Old 09-30-2010, 10:37 AM   #27
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57
Well san, I am out of suggestions...

It's possible the system is messed up ( permission-wise )

This would be a perfect candidate for a re-install or upgrade. But that's totally up to you.

Sorry, my suggestions did not work.
 
Old 09-30-2010, 10:56 AM   #28
san_to_all
LQ Newbie
 
Registered: Sep 2010
Posts: 24

Original Poster
Rep: Reputation: 0
I think I am wrong to say I am in single user mode.But sure, I messed up something with permissions,and I don't remember now exactly.
For me most important thing was my data. and I could backed it up just because all of you guys. Thank's for supporting me.
I'am going to upgrade to F13.
 
Old 09-30-2010, 05:54 PM   #29
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57
Good luck san_to_all
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
chmod 777 and 7777 presarioch Linux - Newbie 4 06-17-2008 01:24 PM
chmod 777 664 zerocool22 Linux - Server 7 06-03-2008 06:58 AM
CHMOD in shell : chmod 777 /usr/ <---is that right? cpanelskindepot Programming 5 07-16-2004 05:37 AM
accidently set "chmod -R 777 *".. need help? scorpatron Linux - General 10 12-05-2003 03:12 AM
chmod 777 /* ziggamon Linux - Newbie 2 09-25-2003 11:40 AM

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

All times are GMT -5. The time now is 04:12 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