# file mode

**URL:** <https://forum.ansible.com/t/file-mode/24531>\
**Category:** Ansible Project\
**Created:** [May 20, 2017, 1:51pm UTC](https://forum.ansible.com/t/file-mode/24531 "2017-05-20T13:51:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Pollinger](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Michael\_Pollinger](https://forum.ansible.com/u/Michael_Pollinger)\
**Post date:** [May 20, 2017, 1:51pm UTC](https://forum.ansible.com/t/file-mode/24531/1 "2017-05-20T13:51:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [May 22, 2017, 8:41pm UTC](https://forum.ansible.com/t/file-mode/24531/2 "2017-05-22T20:41:26Z")

</div>

It documented under mode parameter here  
[https://docs.ansible.com/ansible/file\_module.html#options](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."

---

<div class="post-metadata">

**Author:** ![Daniel\_JD](https://avatars.discourse-cdn.com/v4/letter/d/f19dbf/32.png) [@Daniel\_JD](https://forum.ansible.com/u/Daniel_JD)\
**Post date:** [May 30, 2017, 5:33am UTC](https://forum.ansible.com/t/file-mode/24531/3 "2017-05-30T05:33:16Z")

</div>

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.
