Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
07-09-2006, 09:14 AM
|
#1
|
Member
Registered: Oct 2005
Location: Bhopal, India
Distribution: RHEL 6
Posts: 422
Rep:
|
How can I restore original ownerships on /
Hello friends,
I just broke everything on my operating system. I was having ownership problems with some files and folders. So, accidently I changed the ownerships of all files/folders on / to root:root. Here's
what I did. I know it's really a dumb thing.
1) logged in as root
2) unmounted other linux partitions
3) unmounted /home
4) Changed ownerships of all files on / to root
Code:
chown -cR root:root /
Now, I can't do much from my local user account. can't ping, can't even use su.
Is there any way around to fix the ownerships to their orignal form? Any suggestions?
|
|
|
07-09-2006, 10:53 AM
|
#2
|
Member
Registered: Apr 2005
Location: UK
Distribution: Slackware 13.0
Posts: 241
Rep:
|
Seeing how you've wiped out the ownership of EVERYTHING and that linux does not come with an UNDO button, you're quickest and best bet is to restore from a backup (you DO have a backup?) or to reinstall.
The problem is, yes you could fix your home directory for yourself but there are about 1000 seperate executables, no end of libraries etc. that all have differing permissions. You won't be able to guess those easily, or "blanket" permission them. Restore from backup.
|
|
|
07-09-2006, 11:18 AM
|
#3
|
Member
Registered: Oct 2005
Location: Bhopal, India
Distribution: RHEL 6
Posts: 422
Original Poster
Rep:
|
Hello ledow,
Thanks for the reply. I do have a backup of all my data files but I don't keep any backup of the operating system as I usually change it every month.
It's my personal PC only and even if the operating system crashes, it's not gonna hurt. But, I didn't just do a reinstall as I thought I should learn to fix it.
At present, the situation is a bit better. Now I can login with my normal account in KDE.
I changed the ownership of / again so that I can backup some newly installed config files.
Code:
chown -cR root:users /
My normal username is mann, so
Code:
chown -cR mann:root /tmp/*mann*
Now I am going to reinstall it. Right now I am copying the basic configuration files to a backup folder like smb.conf, vsftpd.conf, inet1.conf etc..so that I wouldn't have to config them again after installation.
I have one more question before I proceed for a reinstall. Should I format the / partition or just do installation over the current one without formatting it? What would u suggest?
Last edited by manishsingh4u; 07-09-2006 at 11:28 AM.
|
|
|
07-09-2006, 11:56 AM
|
#4
|
Senior Member
Registered: Nov 2002
Location: pikes peak
Distribution: Slackware, LFS
Posts: 2,577
Rep:
|
Quote:
Originally Posted by manishsingh4u
Hello friends,
I just broke everything on my operating system. I was having ownership problems with some files and folders. So, accidently I changed the ownerships of all files/folders on / to root:root.
|
basically there are alot of files/scripts that need to be 'world readable' ......since root is the only one who can read them, much needed system scripts can't/won't start........to get everything back to normal you don't need to re-format!! just re-install everything over the the existing files and the ownership/permissions will get reset to what they
were/should be..........
|
|
|
07-09-2006, 01:38 PM
|
#5
|
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928
|
Here's a script which will restore the perms for eevery file on yur system, using the MANIFEST to know what they are.
Actually, this is a script which *writes* a script to do it. The resulting script will prbably be around 30MB!
Something I found awhile back from an old slacker:
http://distro.ibiblio.org/pub/linux/...s-Utils/smprms
Just copy it into /usr/local/bin and make executable to use.
|
|
|
07-09-2006, 03:14 PM
|
#6
|
Member
Registered: Oct 2005
Location: Bhopal, India
Distribution: RHEL 6
Posts: 422
Original Poster
Rep:
|
Thanks a lot friends. I have reinstalled my slackware. And now it's working really fine. Thanks again.
Hello 320mb,
I tried reinstalling over the previous installation but, at the end it gave me some error about less disc space. (I have 3.1 gb for / on reiserfs). And want the full installation so, formatted it and did a fresh install. As I had all the required configuration files and packages in hand, so it didn't take more than 30 min to install extra packages like mplayer, k3b, amsn etc etc. As opposed to this time, when I installed slackware first time, it took me 2 days to bring it to my desired configuration.
Hello gnashley,
You have given me something really amazing. I am gonna recreate this problem on my machine next saturday and will try this script. If it worked, I will name this script as Magic script.
Once again, thanks to all of u.
Last edited by manishsingh4u; 07-09-2006 at 06:57 PM.
|
|
|
07-09-2006, 03:17 PM
|
#7
|
Member
Registered: Oct 2005
Location: Bhopal, India
Distribution: RHEL 6
Posts: 422
Original Poster
Rep:
|
I was just wondering if I could save my system's current ownership / permission settings to some text file or something incase I screw it up again. Is it possible?
|
|
|
07-09-2006, 03:52 PM
|
#8
|
Member
Registered: Apr 2006
Location: A comfy chair...
Distribution: Slackware
Posts: 111
Rep:
|
Quote:
Originally Posted by gnashley
|
That's pretty cool
The one time I made a mistake like manishsingh4u did, I inserted the Slackware CD 1 and did this (as root, of course):
Code:
mount /mnt/cdrom
upgradepkg --reinstall /mnt/cdrom/slackware/*/*.tgz
umount /mnt/cdrom
and then repeated for CD2. Now I would probably expand it to "ls /mnt/cdrom/slackware/*/*.tgz|grep -v '^aaa'|while read PACKAGE; do installpkg $PACKAGE; done", but it seemed to work well.
|
|
|
07-10-2006, 06:19 AM
|
#9
|
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928
|
"save my system's current ownership / permission settings to some text file" can be done like this:
cd /
ls -lR > /path/to/file.list
But I don't think that the smprms script can use the format. You'd need to create a custom MANIFEST showing just the packages you have installed. I'd love it if someone would write a short BASH script that will parse the MANIFEST and print out entries. my PkgBuild program will build an individual MANIFEST entry, but that's for stuff compiled using PkgBuild.
I keep a copy around of another nice tool called slackdeptrack which will tell you what each package on your system provides and depends on.
You might also be interested in this script:
http://distro.ibiblio.org/pub/linux/...bin/chksysdeps
Which will find every executable on your system and run 'ldd' on it, showing the results color-coded. Might surprise you...
|
|
|
07-10-2006, 07:00 PM
|
#10
|
Member
Registered: Oct 2005
Location: Bhopal, India
Distribution: RHEL 6
Posts: 422
Original Poster
Rep:
|
Code:
ls -lR > /path/to/file.list
Thanks gnashley. Now, I think I should code a program in C or C++ which I will use to restore the ownerships / permissions on files. I have once coded a program the changes the permission flags 07xx on files but never thought about the ownerships. I am not good at shell scripting so I don't know which approach would be better. But, yes both of them is gonna teach me a lot I guess.
|
|
|
07-11-2006, 04:22 AM
|
#11
|
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928
|
Just use a BASH script -a C program would be overkill.
|
|
|
All times are GMT -5. The time now is 05:35 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|