LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices

Reply
 
Search this Thread
Old 01-03-2004, 07:11 AM   #1
DutchBoy
LQ Newbie
 
Registered: Jan 2004
Location: Tokyo
Distribution: Redhat 9
Posts: 5

Rep: Reputation: 0
directory permissions incorrectly set


My linux knowledge will be apparent from this post. I ran a chmod incorrectly on the / and /etc directories. I ran the follwing

chmod 700 /
chmod 700 /etc

of course the result of these actions were severe. I rebooted into text mode and ran

chmod 777 /
chmod 777 /etc

so that I could start X and get things working. Now I would like to know which directories I need to have 777 access to and which need lower level access for users other than root.

Thanks for any help.
 
Old 01-03-2004, 10:18 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,261
Blog Entries: 54

Rep: Reputation: 2841Reputation: 2841Reputation: 2841Reputation: 2841Reputation: 2841Reputation: 2841Reputation: 2841Reputation: 2841Reputation: 2841Reputation: 2841Reputation: 2841
Code:
#!/bin/bash
# Purpose: Restore filesystem permissions from RPM database
#            distro's that don't do package management suck major.
#            *Make sure yer RPM database is sane...
# Args: none or package name
# Deps: Bash, GNU utils, rpm
# Run from: manual, emergency only

case "$#" in
0) rpmopt="a"; unset pkg;;
*) unset rpmopt; pkg="$1";;
esac

rpm -q${rpmopt} --dump ${pkg}|while read t; do
        t=( ${t} ); for i in 3 4; do
        case "${#t[$i]}" in
        7) echo "${t[$i]:3:4} ${t[0]}";;
        esac; done
done
Save this as "/tmp/rpm-perms" and make executable.
Running it as "/tmp/rpm-perms > /tmp/rpm-perms.log" should give you the log. Check the contents for errors, then running it as "/tmp/rpm-perms|while read perm file; do chmod ${perm} ${file}; done" should restore all permissions.


If you want to test it, you can also supply a packagename: "/tmp/rpm-perms adore" for instance would list the files and filepermissions of the Adore package.
 
Old 01-05-2004, 04:10 AM   #3
DutchBoy
LQ Newbie
 
Registered: Jan 2004
Location: Tokyo
Distribution: Redhat 9
Posts: 5

Original Poster
Rep: Reputation: 0
bad interpreter

I apologize for the questions but I am new to Linux. I made the script in the /tmp folder and made it executable. Then user ./rpm-perms > rpm-perms.log but I got the error [bad interpreter: No such file or directory]. I checked and I have a /bin/bash file. Might I have the wrong version?
 
Old 01-05-2004, 09:40 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,261
Blog Entries: 54

Rep: Reputation: 2841Reputation: 2841Reputation: 2841Reputation: 2841Reputation: 2841Reputation: 2841Reputation: 2841Reputation: 2841Reputation: 2841Reputation: 2841Reputation: 2841
I apologize for the questions but I am new to Linux.
No need to apologise. Asking questions isn't stupid. NOT asking is.

[bad interpreter: No such file or directory]
- You can only use "./" syntax when you're in the same dir as the script: cd to /tmp first, else use the full path.
 
  


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
PCI cache line size set incorrectly (32 bytes) by BIOS/FW B1TW1SE Linux - Software 1 08-18-2009 02:43 PM
PCI cache line size set incorrectly (32 bytes) by BIOS/FW B1TW1SE Linux - Newbie 4 03-30-2008 11:25 PM
How to permanently set permissions on all files created in a directory? BrianK Linux - General 8 06-24-2004 04:06 PM
How to set correct file/directory permissions pat.delaney Linux - Networking 5 12-02-2003 09:39 AM
write permissions for directory - not accidently move/deleted the directory linuxgamer Linux - Newbie 10 12-02-2003 03:04 AM


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