Sticky bit via pure ruby

In unix you can do:

  chmod -v a+wt /tmp

To set the sticky bit.

But how can I do this via ruby?

···

--
Posted via http://www.ruby-forum.com/.

Just a wild shot in the dark, but according to this (
Sticky bit - Wikipedia), the octal code is 1000
for the sticky bit in unix.

In Ruby's documentation (class File - RDoc Documentation)
File#chmod can set the octal bits for a file, which I would guess would be
1xxx, where xxx is what you normally set your permissions to (644 usually).

-Nick Klauer

···

On Thu, Aug 18, 2011 at 20:00, Marc Heiler <shevegen@linuxmail.org> wrote:

In unix you can do:

chmod -v a+wt /tmp

To set the sticky bit.

But how can I do this via ruby?

--
Posted via http://www.ruby-forum.com/\.

FileUtils in 1.9.3 has this capability, previous versions did not:

~/ruby-1.9.3/bin/ruby -rfileutils -e "FileUtils.chmod('a+wt', '/tmp')"

···

Marc Heiler <shevegen@linuxmail.org> wrote:

In unix you can do:

  chmod -v a+wt /tmp

To set the sticky bit.

But how can I do this via ruby?

Oh yes, makes a lot of sense.

I'll use the octal mode.

Thanks!

···

--
Posted via http://www.ruby-forum.com/.

I meant "did not" meaning it didn't understand "a+wt", not that it
couldn't set the octal mode of 01666.

···

Eric Wong <normalperson@yhbt.net> wrote:

FileUtils in 1.9.3 has this capability, previous versions did not:

~/ruby-1.9.3/bin/ruby -rfileutils -e "FileUtils.chmod('a+wt', '/tmp')"