Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: accidentaly removed all the permission from /bin folder. root not abl to run any cmd

  1. #1
    Join Date
    Oct 2009
    Beans
    4

    accidentaly removed all the permission from /bin folder. root not abl to run any cmd

    I have accidentally change the permission of /bin folder with chmod -rwx /bin
    now i am not able to login with any user or fire any command. can not even change the permission of /bin folder as chmod command is not accessable .

    Only hope is there is one session with which i have logged in, that is the only access i have.

    Let me know if we can change the permission back.

    your quick response will be appreciated.

  2. #2
    Join Date
    May 2008
    Location
    Ohio, USA
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: accidentaly removed all the permission from /bin folder. root not abl to run any

    Did you try to reboot and select the Recovery Mode option from the grub boot menu? If you do that, select to go to the root console. Once there, execute the following to return permissions back:
    Code:
    chmod 755 /bin
    Last edited by jeremyswalker; October 14th, 2009 at 08:42 PM.
    "Anybody who tells me I can't use a program because it's not open source, go suck on rms. I'm not interested. 99% of that I run tends to be open source, but that's _my_ choice, dammit." -- Linus Torvalds, 2004.

  3. #3
    Join Date
    Oct 2009
    Beans
    4

    Re: accidentaly removed all the permission from /bin folder. root not abl to run any

    actually no command which is there in bin is executable!!
    it gives following error

    [root@10 /]# chmod
    -bash: /bin/chmod: Permission denied

  4. #4
    Join Date
    May 2009
    Location
    North West England
    Beans
    2,674
    Distro
    Ubuntu Development Release

    Re: accidentaly removed all the permission from /bin folder. root not abl to run any

    Use a 'Live' CD, drop down to terminal, do a
    Code:
    sudo fdisk -l
    to get your hard drives' name - navigate to the root directory on the hard drive
    issue
    Code:
    sudo chmod 755 /bin
    hopefully, that will get your bin directory back for you.

    Phill.
    Last edited by phillw; October 15th, 2009 at 10:23 AM. Reason: Removed recursive chmod

  5. #5
    Join Date
    May 2008
    Location
    Ohio, USA
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: accidentaly removed all the permission from /bin folder. root not abl to run any

    Yeah, I don't know what I was thinking. You will probably have to use the LiveCD to fix it, as phillw said. However, once you figure out which partition your root filesystem is on, you need to mount it. For example, if it was on /dev/sda1, you would issue the following:
    Code:
    sudo mount /dev/sda1 /mnt/sda1
    Of course, this is just an example. You will have to create the mount point if it doesn't exist.
    Then, working off the example mount point, you would issue the following to change the permissions back:
    Code:
    sudo chmod 755 /mnt/sda1/bin
    Last edited by jeremyswalker; October 14th, 2009 at 08:42 PM.
    "Anybody who tells me I can't use a program because it's not open source, go suck on rms. I'm not interested. 99% of that I run tends to be open source, but that's _my_ choice, dammit." -- Linus Torvalds, 2004.

  6. #6
    Join Date
    Sep 2009
    Location
    127.0.0.1
    Beans
    159

    Re: accidentaly removed all the permission from /bin folder. root not abl to run any

    There is another choice.

    If you still have a session open then just write and compile your own fixup C program. Note that the program will need uid=0 effective permissions to successfully update /bin.

    Return values:

    0 = success
    -1 = failure
    -2 = impossible failure

    caveat: I didn't compile or test it so try it on a scratch machine first.

    ************************************************** **************

    #include <stdio.h>
    #include <errno.h>
    #include <sys/stat.h>

    int main( int argnum, char **argv )
    {
    int ret = -2;

    if((ret = chmod( "/bin", 0x00755 ))
    printf( "error %d\n", errno );


    exit( ret );
    }
    Last edited by __p1n__; October 14th, 2009 at 08:07 PM.

  7. #7
    Join Date
    Feb 2008
    Beans
    606
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: accidentaly removed all the permission from /bin folder. root not abl to run any

    Quote Originally Posted by jeremyswalker View Post
    Code:
    sudo chmod -R 755 /mnt/sda1/bin
    Wouldn't that trash any setuid programs in /bin?

    If the permissions are wrong on the /bin directory, then fixing that is easy. If they're wrong on the programs in the /bin directory then your simplest solution may be a reinstall to ensure that all files have the correct permissions.

  8. #8
    Join Date
    Sep 2009
    Location
    127.0.0.1
    Beans
    159

    Re: accidentaly removed all the permission from /bin folder. root not abl to run any

    Quote Originally Posted by movieman View Post
    Wouldn't that trash any setuid programs in /bin?

    If the permissions are wrong on the /bin directory, then fixing that is easy. If they're wrong on the programs in the /bin directory then your simplest solution may be a reinstall to ensure that all files have the correct permissions.
    Yeah, the command in the original post only affected the /bin folder and not anything in it. Consequently the recursive chmod command is inappropriate.

  9. #9
    Join Date
    May 2008
    Location
    Ohio, USA
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: accidentaly removed all the permission from /bin folder. root not abl to run any

    Quote Originally Posted by __p1n__ View Post
    Yeah, the command in the original post only affected the /bin folder and not anything in it. Consequently the recursive chmod command is inappropriate.
    LOL. I never caught that the first time I read it. Looking back at the original post, I agree the command should not need to be executed recursively. I have fixed my posts accordingly.
    "Anybody who tells me I can't use a program because it's not open source, go suck on rms. I'm not interested. 99% of that I run tends to be open source, but that's _my_ choice, dammit." -- Linus Torvalds, 2004.

  10. #10
    Join Date
    Oct 2009
    Beans
    4

    Re: accidentaly removed all the permission from /bin folder. root not abl to run any

    hey guys thanks for ur response..
    i hv booted from live cd.. n went into rescue mode

    when i type command, it give following reponse
    sh-3.2# sudo mount /dev/sda2 /mnt/sda2
    sh: sudo: command not found

    if i type foll command

    sh-3.2# mount /dev/sda2 /mnt/sda2
    mount: mount point /mnt/sda2 does not exists


    same with the cmd mount /dev/sda1 /mnt/sda1

    and both sda2 n sda1 are there in dev folder.


    sa

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •