file mode

14 views
Skip to first unread message

Michael Pöllinger

unread,
May 22, 2017, 10:19:12 AM5/22/17
to Ansible Project
Hi folks. 

Perhaps i´m wrong, but if i set a file mode with:
- file:
  path: /usr/lib/rssh/rssh_chroot_helper
  mode: 4755

I would expect something like:
-rwsr-xr-x 1 root root 30728 Nov  8  2014 rssh_chroot_helper

But i get this as result:
--w--w--wt 1 root root 30728 Nov  8  2014 rssh_chroot_helper


Am i going wrong or is this a bug?

kind regards
Michael

Kai Stian Olstad

unread,
May 22, 2017, 4:41:58 PM5/22/17
to ansible...@googlegroups.com
It documented under mode parameter here
https://docs.ansible.com/ansible/file_module.html#options

"For those used to /usr/bin/chmod remember that modes are actually octal
numbers (like 0644). Leaving off the leading zero will likely have
unexpected results."

--
Kai Stian Olstad

Daniel JD

unread,
May 30, 2017, 8:35:30 AM5/30/17
to Ansible Project
What you actually want is this:
>>> oct(4755)
'0o11223'
-> rwsr-xr-x

But this is what you got:
>>> oct(658)
'0o1222'
-> -w--w--wt

In your case Ansible dropping the trailing "3".

Just use 04755 as mode argument.
Reply all
Reply to author
Forward
0 new messages