What does `chmod u+s directory` do?

8

2

chmod g+s directory makes new files inherit the group of the directory. I thought that chmod u+s directory would make them inherit the directory owner, but they don't and I see no other effect.

basin

Posted 2014-11-11T13:32:13.687

Reputation: 394

Answers

5

Nothing useful, generally.

According to Sven Mascheck's page on special permission bits, the u+s bit only has an effect on three non-Linux operating systems:

  • on HP-UX up to 9, marks the file as context-dependent (pages 607, 828)

  • on FreeBSD, if built with the kernel option, allows user ownership to be inherited like g+s;

  • on SCO OpenServer, enables file versioning.

user1686

Posted 2014-11-11T13:32:13.687

Reputation: 283 655

But it seems to work on Ubuntu now. – Rick – 2019-02-26T10:00:56.653

homebrew uses u+s on Mac. – isomorphismes – 2020-01-12T17:36:36.530

macOS is probably interpreting it like FreeBSD would. – user1686 – 2020-01-12T20:28:13.517