Adding bash script

28 Views Asked by At

I want to add a Bash script on my guacd to do some tasks for my ssh connection. As shown below, this is the script and I want to limit my ssh commands for all of the users. I do not have any opinion about this, how can I add my script into my Apache Guacamole?

#!/bin/bash

# Check if the script is executed with sudo privileges
if [ "$(id -u)" != "0" ]; then
    echo "This script must be run with sudo. Exiting..."
    exit 1
fi

# Define the aliases
echo 'alias rm="echo \"Error: The rm command is disabled. Access denied.\"" ' >>  /etc/bash.bashrc
echo 'alias cp="echo \"Error: The cp command is disabled. Access denied.\"" ' >>  /etc/bash.bashrc

echo "Aliases for rm and cp commands have been set."

# Source the bashrc file to apply changes immediately
exec bash

echo "Setup complete."

I want to add some limitations on my ssh sessions.

0

There are 0 best solutions below