Reply
Thread Tools
Posts: 25 | Thanked: 8 times | Joined on Jan 2010 @ MUMBAI
#1
Hi...
I accidently did a chown -R user:root * at $
to top that.. I also did chmod -R 755 * at $

I am not sure exactly what has changed ..I mean permissions on my $ (folders and files) and ownership...
can any one help me revert this.. ..

please...thanks already...
__________________
mastermind
 
Posts: 3,617 | Thanked: 2,412 times | Joined on Nov 2009 @ Cambridge, UK
#2
That shouldn't break anything.

You ran it as the normal user ($ prompt rather than # prompt), and presumably from within the user's home directory, so all it'll have done is changed the group ownership of all files to root (doesn't matter - as it's a single-user system, the group ownership of the user's files shouldn't affect anything) and granted everyone read (and execute) access to all files (again, not really important on a single user system).

Do you actually see any issues?
 

The Following User Says Thank You to Rob1n For This Useful Post:
Posts: 25 | Thanked: 8 times | Joined on Jan 2010 @ MUMBAI
#3
now i am not sure if it did change anything...it showed that operation not permitted for certain files..but not for all...
so i am sure some operation was performed on the remaining files..and it seemed like a recursive call for all the files / folders..within $...

now when I do $ ls -l it shows that
certain files have
user users
user root
root root

so what exactly are these against the files / folders.. one is the owner/group? and how does this affect..


i can see all diff permissions on these entries .. like r w x ..values..

(( ....
__________________
mastermind
 
Posts: 539 | Thanked: 165 times | Joined on Feb 2010 @ Berlin, Germany
#4
I guess you could simply change ownership back to user by calling from home directory
Code:
chgrp -R user *
Restoring access rights is quite difficult as some files need to be executable and some not. In general it's not dangerous having all files with executable bit set, but it might be if there are some files which are not supposed to be run by themselfes or to be run at all and which may do quite harmful things to your device. Setting all files to non-executable is no solution as some files need to be executable (like scripts for QBW, DCEW or alarmed). Setting them to no-exec might break some apps. Best would be to either restore old settings (in case you have a full backup) or to leave it as it is and be VERY careful when executing commands or scripts.

Just curious: why did you do that? Some script running wild or testing random commands or what did you try to do?
 

The Following User Says Thank You to x-lette For This Useful Post:
Posts: 539 | Thanked: 165 times | Joined on Feb 2010 @ Berlin, Germany
#5
Originally Posted by abhishek View Post
now i am not sure if it did change anything...it showed that operation not permitted for certain files..but not for all...
so i am sure some operation was performed on the remaining files..and it seemed like a recursive call for all the files / folders..within $...
Given you started the command in /home/user (which is the home directory of the normal user) then
  1. only files within this directory tree are affected (i.e. no files in / or /usr/bin or elsewhere)
  2. only files where you had the right permissions to change ownership and mod are affected
  3. no files in directory /home/user/MyDocs are affected as this directory contains a vfat partition where no ownership or modus can be set.

now when I do $ ls -l it shows that
certain files have
user users
user root
root root

so what exactly are these against the files / folders.. one is the owner/group? and how does this affect..

i can see all diff permissions on these entries .. like r w x ..values..
A usual line looks like this:
Code:
-rwxr--r--  1 user games 123 Nov  1 12:34 somefile
which means:
  1. this is a file and no directory (-)
  2. owner may read and write this file and also may execute it (rwx)
  3. groupmembers and all other users may read this file but may not write to it or execute it (r--r--)
  4. there is one link to this file (1)
  5. the owner is "user"
  6. the group is "games"
  7. the size is 123 bytes
  8. the file was last changed on Nov, 1st at 12:34
  9. the files name is "somefile"
 

The Following User Says Thank You to x-lette For This Useful Post:
Posts: 25 | Thanked: 8 times | Joined on Jan 2010 @ MUMBAI
#6
Originally Posted by x-lette View Post
Just curious: why did you do that? Some script running wild or testing random commands or what did you try to do?
i wanted to run this at a specific folder.. i used CD to change directory right before i was to do a chown ..however the cd command didn't succeed..which i failed to notice..in a bit of hurry ..i typed the next few commands...

thanks guys..for the support and quick help ..and guidance..
i ll sure learn from ur tips and also guide some newbie like me in future
__________________
mastermind
 
Posts: 38 | Thanked: 33 times | Joined on Aug 2010 @ Bangalore, India
#7
Are you sure the cd didn't succeed? Where did you intend to change directory to? Just before the $ will show the place where you are currently in the file system. If you are in /home/user it should show ~

Was this what was shown before you executed the chown chmod commands?
 
Posts: 25 | Thanked: 8 times | Joined on Jan 2010 @ MUMBAI
#8
Originally Posted by kitwalker View Post
Are you sure the cd didn't succeed? Where did you intend to change directory to? Just before the $ will show the place where you are currently in the file system. If you are in /home/user it should show ~

Was this what was shown before you executed the chown chmod commands?

yes it did not succeed....i learnt late why it didn't ..i was using tab to fill in the folder name while typing...all in a hurry..

i still am not able to do what i intended to sort out...the files in this folder are with permissions -rw-r--r-- which i want to change to -rwxrwxrwx

if i do ls -l i get
-rw-r--r-- 1 user root <size> <sort of timestamp> <filename>

why is chmod -R 777 * not working here?
any idea ?

i tried it at $ and also using sudo gainroot..
didn't work either time..
__________________
mastermind
 
Posts: 38 | Thanked: 33 times | Joined on Aug 2010 @ Bangalore, India
#9
That's exactly why I asked you if you were in your home folder denoted by ~ before the $ prompt or you are in /home/user/MyDocs.

These are basically part of two separate file systems. /home/user becomes part of /home which is ext2. So changing file permissions will work there. However, /home/user/MyDocs is a VFAT file system. Changing file permissions will not work there.

Do one simple example:

In your ~ folder (/home/user) create a file as:

Code:
~ $ touch tmp_file
Then, change the file permissions:

Code:
~ $ chmod 777 tmp_file
~ $ ls -l tmp_file
You will see that the file permissions have changed as rwxrwxrwx

Now cd to /home/user/MyDocs and repeat this procedure. The file created there will have permissions -rw-r--r--. Also the group owner will be root and not users. If you try chmod 777 on the tmp_file here the permissions will still remain as -rw-r--r--.

Last edited by kitwalker; 2010-11-11 at 07:17. Reason: Added last line
 

The Following User Says Thank You to kitwalker For This Useful Post:
Posts: 255 | Thanked: 61 times | Joined on Feb 2010
#10
Permissions Fail.
__________________
Desktop: 2.8ghz Athlon x2 Kuma 4gb DDR2 OCZ Platinum XFX Geforce 260GTX BE
 
Reply


 
Forum Jump


All times are GMT. The time now is 11:38.