streda 18. októbra 2023

User root not allowed because shell bash does not exist

 

or permission denied via ssh keys? 


 

I started this command from "ansible server" to others...

ansible all -m shell -a "usermod -s ksh root"

after that: servers lost ssh connection!

How to check the problem?

-- connect to all of "infected servers"

1)check the logs

2) on RHEL ssh connection is on /var/log/secure

- so:

cat /var/log/secure | egrep -i shell

Oct 18 21:43:10 app_server usermod[14443]: change user 'root' shell from '/bin/bash' to 'ksh'

Oct 18 21:45:44 app_server sshd[15036]: User root not allowed because shell ksh does not exist

Oct 18 21:45:54 app_server sshd[15039]: User root not allowed because shell ksh does not exist

I tried change shell from ksh to bash: but:

Oct 18 21:50:06 app_server sshd[15547]: User root not allowed because shell bash does not exist

How to repair? USE THE FULL PATH!

Oct 18 21:52:46 app_server usermod[15574]: change user 'root' shell from 'bash' to '/bin/bash'

now we can check ansible

[root@kirk scripts]# ansible all -m ping

MRSpock | SUCCESS => {

"ansible_facts": {

"discovered_interpreter_python": "/usr/libexec/platform-python"

},

"changed": false,

"ping": "pong"

}

DrMccoy | SUCCESS => {

"ansible_facts": {

"discovered_interpreter_python": "/usr/libexec/platform-python"

},

"changed": false,

"ping": "pong"


Žiadne komentáre:

Zverejnenie komentára