I can run the following script locally and works fine
echo "HOST,UserName,IsDiabled,PassLastSet" >/opt/BESClient/bin/ciplinux.csv ; for user in $(cut -f'1' -d':' /etc/passwd); do echo "hostname,sudo passwd -S $user"; done | sed 's/ /,/g' | cut -f1-4 -d',' | sed 's/LK/DISABLED/' | sed 's/PS/ENABLED/' >> /opt/BESClient/bin/ciplinux.csv
// Enter your action script here
//ADD CODE HERE TO CREATE "CIPcombinedaccounts.csv" FILES.
delete __appendfile
if {name of operating system contains "inux"}
appendfile #!/bin/sh
appendfile echo "HOST,UserName,IsDiabled,PassLastSet" >/opt/BESClient/bin/ciplinux.csv ; for user in $(cut -f'1' -d':' /etc/passwd); do echo "`hostname`,`sudo passwd -S $user`"; done | sed 's/ /,/g' | cut -f1-4 -d',' | sed 's/LK/DISABLED/' | sed 's/PS/ENABLED/' >> /opt/BESClient/bin/ciplinux.csv
delete "hostname.sh"
delete "{pathname of parent folder of client}/ciplinux.csv"
move __appendfile "hostname.sh"
wait chmod +x hostname.sh
wait ./hostname.sh
endif
I expect the ‘sudo’ command may be interrupting the script, perhaps by opening a new shell. Since the BigFix client is already running as root, you may be able to execute the command without sudo.
The agent is running with enough privilege so you don’t need to use sudo.
Also be aware that the agent’s environment is not the same as when you login with a shell.
Check to see if this is an issue.
Thanks for pointing out “sudo” as that was the cause of the issue. I over looked that this as the agent does run as root. Thanks for the additional education tips which are always much appreciated. As always everyone’s support is what also makes BigFix so great. Your always there. Have a great memorial weekend.