When I login to bastion server every time, there is initial shell script which will run and records sessions.
if [[ -z $SSH_ORIGINAL_COMMAND ]]; then
LOG_FILE="`date --date="today" "+%Y-%m-%d_%H-%M-%S"`_`whoami`"
LOG_DIR="/var/log/ssh-bastion/"
echo ""
echo "NOTE: This SSH session will be recorded"
echo "AUDIT KEY: $LOG_FILE"
echo ""
# suffix the log file name with a random string.
SUFFIX=`mktemp -u _XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`
script -qf --timing=$LOG_DIR$LOG_FILE$SUFFIX.time $LOG_DIR$LOG_FILE$SUFFIX.data --command=/bin/bash
else
echo "This bastion supports interactive sessions only. Do not supply a command"
exit 1
fi
Now when I try to login its giving below error
script: cannot open /var/log/ssh-bastion/2024-03-29_06-52-11_username_m8hI1GxwGYd5847vhanBcn9Www1Koq8X.data: Permission denied
It was working well earlier and I have been facing this issue since 2 days. All my directory permissions are same and there is no change in any file/directory permissions.