You are not logged in.
greetings
i am a terrible newbie of linux.
and when i am trying to chown one directory /home/someone/dX to be owned by account , say userA, i stupidly cd to /home/someone/dX and using the below command as a root:
chown -hR userA /.
I cant exlain why i did this, but the result is that nearly all the directory/files of the computer become owned by userA.
My question is , is there any way to restore all my changes caused by this command...
Last edited by samp (2008-02-28 17:42:43)
Offline
Heh, not bad. I'm sorry, but I don't think, you can undo this one.
Offline
deleted
Last edited by Misbah (2012-02-14 06:02:50)
Offline
What Misbah said is correct. You can't regress the change. Though you can try to fix the system by making more changes.
I'd recommend:
chown -hR root / # Have root own _all_ files
cd /home
# Selectively give files to other users
# (ie give UserA /home/UserA and give UserB /home/UserB)
# Might get some warnings/errors for things like /home/samba if there is no samba user
for i in *; do
chown -hR $i $i
done
You still might need to make some further changes. For example if you chown you destroy setuid bits. So you'll want to chmod u+s sudo and passwd and the like.
Also you might need to give some things in /var to other people
and check permissions of /tmp, you need that to be set as a temporary folder (chmod 1777 /tmp)
Good luck! Hope you don't need a reinstall.
Offline
Hi guys,
thank you very much for your response.
I was just thinking what if i delete the userA from the system, what will it happen, will all the ownership restore to original state?
Offline
I was just thinking what if i delete the userA from the system, what will it happen, will all the ownership restore to original state?
No, certainly not. The only thing that'd happen is that you'd no longer see that files are associated to this user name but to the UID of the deleted user.
If I were you, I'd restore the ownerships of the files in my home directory, backup it and then re-install the system. In the end that'll safe you time + some headaches.
Offline
It should be possible to recover to get a working system. My son did an identical thing trying to set the mount point for his external caddy to be owned by his user. This was on SimplyMEPIS 64.
He had everything owned by jon:users, so here are excerpts from my emails (using guest user on my Mepis 32 system):
*******************************************
DON'T DO THIS:
I mucked up my 32 bit Mepis "su" (roughly in the same way as you?) I su'd and cd'd to / then
chown -R guest *
chown -R root *
chown -R guest /home/guest
Logging into guest I had the same problems i.e. got invalid password when su
from in a terminal or when running mepis system stuff from kmenu (uses kdesu)
DO THIS:
This should solve it:
Login in as root
run konqueror and navigate to /bin
right click on su
click the permissions tab
check the box "user: Set UID"
click on OK to close etc
You should know be able to log in as jon and use su and kdesu
*******************************************
his response was:
*******************************************
Since reseting the profile using the User Manager when I start up I get an error saying I;m not permitted to connect to the powersave daemon via DBUS, however I haven't noticed any ill-effects.
Well mostly fixed anyway. I can still enter the password on synaptic etc. but for some reason if I am changing between sessions it wouldn't accept the password for 'jon'. Not that this is a huge problem.
*******************************************
My response was
*******************************************
Me too. Tick the "Set UID" box for /usr/bin/kcheckpass
On my Arch linux, the following programs are UID or GID:
$ ls -l /opt/kde/bin/ | grep "sr-"
-rwsr-xr-x 1 root root 2852 2007-11-10 20:54 fileshareset
-rwsr-xr-x 1 root root 15194 2008-01-26 17:45 kcheckpass
-rwxr-sr-x 1 root nobody 56265 2008-01-26 17:46 kdesud
-rwsr-xr-x 1 root root 5876 2007-11-10 20:54 kgrantpty
-rwsr-xr-x 1 root root 567112 2007-10-14 22:28 kppp
-rwsr-xr-x 1 root root 5500 2007-11-10 20:54 start_kdeinit
Mepis has those programs in /usr/bin. "s" in the first block means "Set
UID", "s" in the second block (kdesud) means "Set GID".
The powersave problem may be due to start_kdeinit not being able to run as
root so let me know if that is fixed by the above mod.
*******************************************
Of course some ownerships are still wrong (nobody etc) so I guess security isn't quite up to scratch.
That was on 4th Feb and it is his main system - no problems reported back so far.
Basically, chown everything (/, recursively) to root, chown each users home recursively to that user, then deal with a few set UID & GID problems.
Offline