Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

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

    Reply
    Page 1 of 2 | 1   2   | Next
    abhishek | # 1 | 2010-11-10, 10:35 | Report

    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...

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Rob1n | # 2 | 2010-11-10, 10:40 | Report

    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?

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to Rob1n For This Useful Post:
    abhishek

     
    abhishek | # 3 | 2010-11-10, 10:47 | Report

    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..

    (( ....

    Edit | Forward | Quote | Quick Reply | Thanks

     
    x-lette | # 4 | 2010-11-10, 10:55 | Report

    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?

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to x-lette For This Useful Post:
    abhishek

     
    x-lette | # 5 | 2010-11-10, 11:16 | Report

    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.

    Originally Posted by
    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"

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to x-lette For This Useful Post:
    abhishek

     
    abhishek | # 6 | 2010-11-10, 11:49 | Report

    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

    Edit | Forward | Quote | Quick Reply | Thanks

     
    kitwalker | # 7 | 2010-11-10, 12:06 | Report

    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?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    abhishek | # 8 | 2010-11-11, 06:29 | Report

    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..

    Edit | Forward | Quote | Quick Reply | Thanks

     
    kitwalker | # 9 | 2010-11-11, 06:59 | Report

    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--.

    Edit | Forward | Quote | Quick Reply | Thanks

    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:
    abhishek

     
    ear0wax | # 10 | 2010-11-11, 07:14 | Report

    Permissions Fail.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Page 1 of 2 | 1   2   | Next
vBulletin® Version 3.8.8
Normal Logout