LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   I need default rwx values for /var /usr =/ (https://www.linuxquestions.org/questions/linux-general-1/i-need-default-rwx-values-for-var-usr-%3D-185814/)

dmx9595 05-25-2004 06:08 PM

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

korozion 05-26-2004 01:22 AM

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

Tinkster 05-26-2004 03:45 AM

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

dmx9595 05-26-2004 12:11 PM

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

Tinkster 05-26-2004 02:18 PM

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

dmx9595 05-26-2004 02:39 PM

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

Tinkster 05-26-2004 05:15 PM

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


All times are GMT -5. The time now is 02:32 AM.