ManInMoon
ManInMoon

Reputation: 7005

How can I set the "directory" bit in unix permissions

I did a:

chmod 7777 MYDATA

On MYDATA which is a directory. Now it is no-longer recognised by unix (Cygwin actually) as a directory:

-rwxrwxrwx+ 1 Administrators Domain Users  63 Apr  4 10:19 MYDATA

How can I set the first character back to being a "d"?

Upvotes: 1

Views: 574

Answers (1)

Sobrique
Sobrique

Reputation: 53478

You can't. That d isn't a permission, it's an attribute. Mostly you'll see '-' or 'd' but you'll see a selection of others if your browse /dev. I'm actually a bit surprised you've managed to turn a directory into a file in this way. Are you entirely sure that MYDATA was a directory to start off with? Of the 4 modes you've set, you should have got a file (or directory!) with:

  • user/group/other read/write/execute
  • setgid, setuid, and 'sticky' bit set.

chmod shouldn't be able to turn a directory into a flat file, unless you've found a really strange bug.

Upvotes: 1

Related Questions