AIX pam ssh/sshd configuration not allowing sed or awk

This is a weird problem. Following is my code.

/opt/quest/bin/vastool configure pam sshd
/opt/quest/bin/vastool configure pam ssh

cat /etc/pam.conf | \
awk '$1=="ssh"||$1=="sshd"||$1=="emagent"{sub("prohibit","aix",$NF);}1' OFS='\t' > /etc/pam.conf

cat /etc/ssh/sshd_config | \
sed -e 's/^UsePAM no/UsePAM yes/' > /etc/ssh/sshd_config

If I remove below from the script, both awk and sed are working accordingly.

/opt/quest/bin/vastool configure pam sshd
/opt/quest/bin/vastool configure pam ssh

But if I execute them together, those files, which are supposed to change are becoming empty :confused::confused:

Is there any relation between pam ssh configuration and sed/awk? I totally not getting the point behind that.

I wonder if vastool is running something in the background and the .conf files havent been written yet when your sed/awk runs. Try putting a wait or sleep 10 before you process the .conf files.

I tried that, but still it is doing the same. :(:(:frowning: