-1

The idiot that I am, I changed the chmod of a certain directory to 0041 while trying to create directories for each month in a year programatically - I still own the folder, but can't do anything with it.

Is there any way to get rid off said folder (except of fiddling around on hardware level?)

Best Regards, Zahlii

Zahlii
  • 818
  • 1
  • 7
  • 17
  • 2
    This site is for programming questions. We are not general system tech support. but yes, you can easily remove it as root, regardless of the permissions. – Marc B Jul 28 '15 at 18:56

1 Answers1

3

You can simply set a sensible mode with sudo (or as root user):

sudo chmod -R 755 /path/to/directory

… or delete the directory:

sudo rm -rf /path/to/directory

I’d recommend to reset the mode first, check the contents of the directory, and then possibly remove the directory as normal user (or, without sudo). Note that rm -rf is dangerous, especially as root/sudo because it deletes entire directory trees without asking questions.

lxg
  • 12,375
  • 12
  • 51
  • 73
  • I'm downvoting this answer because as currently written it advocates an extremely insecure practice: namely, it advises OP to run `sudo rm -rf` on an unknown directory, presumably on a web werver, with no warning whatsoever. – Two-Bit Alchemist Jul 28 '15 at 21:54
  • 1
    @Two-BitAlchemist: OP does know what folder it is, so there should not be any harm in running it. But, you're right, if somebody comes along with a similar problem, they shouldn't think that `rm -rf` is a no-brainer. I've added a warning to the post. – lxg Jul 28 '15 at 21:58
  • 1
    Thanks, I've changed my vote. I know it's not a bad thing for the OP here, but it's like answering with eval. I feel it's our responsibility to warn future Googlers. After all, most of the point of SO is remaining around long after OP leaves as a reference. – Two-Bit Alchemist Jul 29 '15 at 15:36