0

I have a login script that runs when users logs into a Linux machine.

#!/bin/bash
if [ "$SSH_TTY" ]; then

This script is interfering with a monitoring software that also connects over SSH. The script requests "press any key to continue" with a read -p -n1 -s portion. How can I omit this script only when the monitoring service is "logging in?"

0

How can I omit this script only when the monitoring service is "logging in?"

Assuming this login script is in /etc/profile.d you could do this:

if [[ $(whoami) != "monitor_user" ]]; then
   <run rest of script>
fi

You will of course need to change "monitor_user" into the proper username for the monitoring user/agent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.