LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-25-2004, 06:08 PM   #1
dmx9595
Member
 
Registered: Jun 2003
Location: Canada,Ontario
Distribution: Debian and Gentoo
Posts: 135

Rep: Reputation: 15
I need default rwx values for /var /usr =/


hey got a problem i backuped up /usr /var with just cp -R then recreated the parition then moved back all the files, but i guess when i backuped it up it didnt preserve the originial rwx/ownership modes so now the rwxrwxrwx modes are all messed up, and i cant run certain programs, only root can and ive been using chmod u+s program without really knowing what setuid does till i just saw that it changes the process id as root so thats not good =/ so yeah i need to restore the orginail default values for /usr /var and all the subdirectories, does anyone know where i can that info from or possibly could someone post here a ls -al /usr and /var or any other ideas? thanks
 
Old 05-26-2004, 01:22 AM   #2
korozion
Member
 
Registered: Apr 2004
Location: Canada
Distribution: Debian
Posts: 124

Rep: Reputation: 15
Maybe I shouldn't do this due to security, but what the hell. It'll be hard for you to match all the perms, but here you go http://magi.tldp.ca/files/var.tar.bz2 http://magi.tldp.ca/files/usr.tar.bz2
 
Old 05-26-2004, 03:45 AM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,965
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
Re: I need default rwx values for /var /usr =/

Quote:
Originally posted by dmx9595
hey got a problem i backuped up /usr /var with just cp -R then recreated the parition then moved back all the files, but i guess when i backuped it up it didnt preserve the originial rwx/ownership modes so now the rwxrwxrwx modes are all messed up, and i cant run certain programs, only root can and ive been using chmod u+s program without really knowing what setuid does till i just saw that it changes the process id as root so thats not good =/ so yeah i need to restore the orginail default values for /usr /var and all the subdirectories, does anyone know where i can that info from or possibly could someone post here a ls -al /usr and /var or any other ideas? thanks
I once came across this script, googling. It restores the permissions
on a file-system in Slack from the MANIFEST.gz file of your installation
CD ;)

Code:
#!/bin/sh
#smprms
#Create a script to restore the filesystem permissions from the MANIFEST (stdin)
#

about_text='
# Author:   Cameron Kerr
# Email:    cameron.kerr@paradise.net.nz
# Website:  http://homepages.paradise.net.nz/~cameronk/
# Version:  27 August 2001'

if [ $# -ne 0 ]; then
  echo "USAGE: zcat MANIFEST.gz | `basename $0` > /tmp/longscript.sh" >&2
  echo "       su - (if not root already)" >&2
  echo "       /tmp/longscript.sh" >&2
  exit 255
fi  

echo "#!/bin/sh"
echo "#This script was generated by `basename $0` from a Slackware MANIFEST.gz"
echo "#It will restore permissions to all files listed in the MANIFEST.gz,"
echo "#even files not there, so you might like to filter out 'not found'"
echo "#messages"
echo "#"
echo "#About the generator ${about_text}"

cat | sed -e '
/^++==*/d
/^||/d
/^ *$/d
/^[-dlcbps]/{
  s/^\(.*\) \(.*\)\/\(.*[^ ]\)  *.* .* .*  *\(.*\)$/\
chown \2.\3 \/\4\
chmod PERM\1PERM \/\4/
  /PERM.*PERM/{
    s/PERM.\(...\)\(...\)\(...\)PERM/u=PERM\1PERM,g=PERM\2PERM,o=PERM\3PERM/
  }
  /PERM.*[^ ]PERM/{
    s/-//g
  }
  s/PERM//g
}
'
It shouldn't be too hard to make it modify only the ones under a given
subdirectory...

Cheers,
Tink
 
Old 05-26-2004, 12:11 PM   #4
dmx9595
Member
 
Registered: Jun 2003
Location: Canada,Ontario
Distribution: Debian and Gentoo
Posts: 135

Original Poster
Rep: Reputation: 15
hmm this is not good after running that script i now get permission denied for anyone other then root while trying to access basic programs like ls or touch but looking at the permissions of /bin and /bin/ls for example seem correct i have r and x permission for all users
damn this sucks i think i might actually wipe everything and reinstall slack, i was thinking of doing that before to install current instead of 9.1 so this might actually just push me to do that =/ i also wanted to try LFS first but looks like ill just reinstall slack probably

oh wait rather it was i couldnt ls or touch in the directories i was in, which i should be able to

Last edited by dmx9595; 05-26-2004 at 01:17 PM.
 
Old 05-26-2004, 02:18 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,965
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
If the permissions on the executables are OK
check the permissions on the libraries they
require ...

E.g. if bash gives you permission denied,
check
ldd /bin/bash | cut -d" " -f 3 | xargs ls -l

Remember, this is linux, as long as it is reachable,
it can be fixed ;)


Cheers,
Tink
 
Old 05-26-2004, 02:39 PM   #6
dmx9595
Member
 
Registered: Jun 2003
Location: Canada,Ontario
Distribution: Debian and Gentoo
Posts: 135

Original Poster
Rep: Reputation: 15
true yeah i know its not like linux to just reinstall but this is a ugly problem cause all of /usr and /var permissions are messed up and i cant really track every file/dir one by one or something, not too sure what else to do
 
Old 05-26-2004, 05:15 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,965
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
The alternative is not to re-install Slack but just reinstall all
packages. That will preserve all your settings, "new" versions of
config-files would be called xxx.new

mount slack-cdrom
upgradelpkg --reinstall /<cdrom>/slackware/*/*.tgz

Cheers,
TInk
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ prototyped func with default values ? Bluesuperman Programming 3 02-03-2005 09:20 AM
totem seek values and konqueror default profile mickyg Linux - Software 1 10-28-2004 06:12 AM
can /usr and /var be install in a different hd? ziggie216 Linux - General 1 12-29-2003 06:15 AM
useradd with default values ?! realos Linux - Newbie 1 08-09-2002 07:38 AM
default values for /proc/sys/net/ipv4 robeb Linux - Networking 0 06-07-2002 12:35 AM


All times are GMT -5. The time now is 06:11 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration