maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   Quick help required! I accidently used CHOWN and CHMOD at $ (https://talk.maemo.org/showthread.php?t=65387)

abhishek 2010-11-10 10:35

Quick help required! I accidently used CHOWN and CHMOD at $
 
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...

Rob1n 2010-11-10 10:40

Re: Quick help required! I accidently used CHOWN and CHMOD at $
 
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?

abhishek 2010-11-10 10:47

Re: Quick help required! I accidently used CHOWN and CHMOD at $
 
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..

:((( ....

x-lette 2010-11-10 10:55

Re: Quick help required! I accidently used CHOWN and CHMOD at $
 
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?

x-lette 2010-11-10 11:16

Re: Quick help required! I accidently used CHOWN and CHMOD at $
 
Quote:

Originally Posted by abhishek (Post 868986)
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.

Quote:

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"

abhishek 2010-11-10 11:49

Re: Quick help required! I accidently used CHOWN and CHMOD at $
 
Quote:

Originally Posted by x-lette (Post 868993)
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 ;)

kitwalker 2010-11-10 12:06

Re: Quick help required! I accidently used CHOWN and CHMOD at $
 
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?

abhishek 2010-11-11 06:29

Re: Quick help required! I accidently used CHOWN and CHMOD at $
 
Quote:

Originally Posted by kitwalker (Post 869061)
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..

kitwalker 2010-11-11 06:59

Re: Quick help required! I accidently used CHOWN and CHMOD at $
 
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--.

ear0wax 2010-11-11 07:14

Re: Quick help required! I accidently used CHOWN and CHMOD at $
 
Permissions Fail.


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

vBulletin® Version 3.8.8