There is a very good, detailed answer on using chroot
here.
As user1461135 said, you need to add the iso to your Virtual Machine, boot using it and then mount your /
partition. So, first of all check the name of your /
partition. Log into your Linux System and run:
$ mount | grep "/ "
This should return a line like:
/dev/disk/by-uuid/d5cf13h31-f344-41237-92c5-e29c6006442h60 on / type
ext4 (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered)
or like this:
/dev/sda7 on / type ext4
(rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered)
In the first case, your partition is mounted by its UUID. To find out which device this UUID corresponds to run:
$ ls -l /dev/disk/by-uuid/
You will see that the UUID returned by mount
corresponds to a specific /dev/sdX
device. ON my system, it is /dev/sda7
. If you have a line like the second example above, you already know the device.
Now, boot into the live session from the CD as suggested in the comments, create an empty directory, and mount your system there:
$ mkdir mountpoint
$ sudo mount /dev/sda7 mountpoint
Remember to replace sda7
with whatever your partition is. Once the system is mounted, I am not even sure you will need chroot. You can probably just run the chmod command directly:
$ sudo chmod 755 mountpoint/etc
Now, reboot your Linux system and things should be back to normal.
Have you considered booting a live cd, mounting your system and chrooting into it? If I recall correctly, you don't need a root password (but not 100% sure) – javex – 2012-09-01T21:12:15.023
@javex I'm running ubuntu in vmware, I know this might sound silly, but can you tell me how to do it? I only have iso files no physical disk. – None – 2012-09-01T21:15:16.367
No problem, just behave like you would have if you wanted to install it in a new VM: Mount your
– javex – 2012-09-01T21:17:47.423iso
file and let it boot from disk (should be default). Then it gives you the same prompt as if you were about to install. Also check this entry (its ArchLinux, but its universal): https://wiki.archlinux.org/index.php/Change_Root#Change_root . Make sure to use the same architecture (its best to use the same iso)