# Ansible automation on AIX with permitrootlogin no

**URL:** <https://forum.ansible.com/t/ansible-automation-on-aix-with-permitrootlogin-no/31624>\
**Category:** Ansible Project\
**Created:** [November 8, 2019, 10:20am UTC](https://forum.ansible.com/t/ansible-automation-on-aix-with-permitrootlogin-no/31624 "2019-11-08T10:20:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ks\_Iam](https://avatars.discourse-cdn.com/v4/letter/k/e19b73/32.png) [@ks\_Iam](https://forum.ansible.com/u/ks_Iam)\
**Post date:** [November 8, 2019, 10:20am UTC](https://forum.ansible.com/t/ansible-automation-on-aix-with-permitrootlogin-no/31624/1 "2019-11-08T10:20:20Z")

</div>

I’m working with my vendor to setup the Ansible to harden my AIX servers. I was informed that Ansible required to login as root via SSH to perform the task, which means the sshd\_config has to enable permitrootlogin, despite setting “permitrootlogin no” is 1 item in the hardening checklist. The vendor proposed solution is to either set the root without password and authenticate via public/private key, or to install sudo rpm into the box (AIX doesn’t come with sudo by default). They don’t recommend the latter method due to IBM is not going to support it as well as vulnerability that possible to be found on it. I’m not an AIX expert and thus would like to know whether the claims are true.

Thinking to keep the hardening checklist intact, I’m exploring other alternative and found the “become” from Ansible Doc [here](https://docs.ansible.com/ansible/2.5/user_guide/become.html). Can this be the solution to retain the “permitrootlogin no” on the server? Or else how is everyone handle this?

Thanks!

---

<div class="post-metadata">

**Author:** ![sdoran](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@sdoran](https://forum.ansible.com/u/sdoran)\
**Post date:** [November 12, 2019, 3:53pm UTC](https://forum.ansible.com/t/ansible-automation-on-aix-with-permitrootlogin-no/31624/2 "2019-11-12T15:53:53Z")

</div>

Ansible does not need to log in as root. Most environments log in as a user account that has full sudo privileges.

I would argue that installing sudo is less of a risk than allowing direct root login via ssh, but I have never administered an AIX environment.

You could reach out to the [AIX working group](https://github.com/ansible/community/wiki/AIX) and see if they are able to offer any guidance.

---

<div class="post-metadata">

**Author:** ![ks\_Iam](https://avatars.discourse-cdn.com/v4/letter/k/e19b73/32.png) [@ks\_Iam](https://forum.ansible.com/u/ks_Iam)\
**Post date:** [November 13, 2019, 8:30am UTC](https://forum.ansible.com/t/ansible-automation-on-aix-with-permitrootlogin-no/31624/3 "2019-11-13T08:30:13Z")

</div>

Apparently installing sudo is less of a risk but we also put support into consideration, since sudo for AIX considered open source software and will not be officially supported by IBM, which required by my organization.  
Went through [one of the article](http://kairo.eti.br/aix-powervm-automation-with-ansible.html#distributing-keys) sourced from AIX working group, the become plugin was recommended, which is a tool leverage on privilege escalation command (sudo | su | pbrun | pfexec | doas | dzdo | ksu | runas | machinectl).

So now it leave us with 2 options:

1. as our vendor proposed, to enable root login through SSH with no password, and authenticate with keys;
2. To rely on Ansible become plugin with become method su (since sudo is not an option).

With that I would like to seek advice on which will be the better in terms of security. Not sure whether this becomes an opinion based question and a bit out of topic though, but I appreciate any input.

Thanks!

---

<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:** [November 13, 2019, 2:10pm UTC](https://forum.ansible.com/t/ansible-automation-on-aix-with-permitrootlogin-no/31624/4 "2019-11-13T14:10:42Z")

</div>

If you login as root, every task is run as root, but if you use su you can  
choose which task(s) to run as root.  
And choosing su will preserve your which in you first post  
"keep the hardening checklist intact".
