As already stated by kilgoretrout, root should be able to remove any file or directory, despite its permissions (unless some extended attributes are set) and its owner. Even if the file/directory has no permissions at all, like
Code:
d--------- 2 root root 4096 Jan 11 17:44 testdir
So the question is: are you sure you're running commands as root? Regarding your original question, if you installed some applications compiling them from source, removing the source directory does not uninstall the application, unless you explicitly installed it under the source directory itself. If you did not issue a
make clean or
make distclean command in the source directory, you should be able to issue a
make uninstall, if the uninstall target is provided by the Makefile. Then you can safely remove the source directory and have the application completely removed.
If the problem is just to change the owner of the directory, use the
chown command. For example:
Code:
chown -R root:root /opt/dir
will change recursively the owner and group of /opt/dir, being the name before the colon a valid username and the name after the colon a valid group name to which the user belongs.