You should be able to use $REMOTE_USER in the command that is being executed in Webmin I’ve done this in USermin. I assume it’s the same in Webmin.
So, in the the webmin command configuration for the command I you would put:
Then, in your script, you would have USER=$1 (or whatever the syntax is in bash to get the first argument)
Like I said, I’ve done this in Usermin, but it should work similarly in Webmin.
I’m trying to execute a bash script through webmin and have the current webmin users login name be passed to the script. I’ve googled a bit and found that $REMOTE_USER is the environmental variable that should pass that information to the script but it’s not working.
Here’s the script:
echo "The user executing this script is $USER"
The result when I execute the script is:
Output from ssh -l user linuxserver /home/user/scripts/id-test.sh ..
The user executing this script is
I feel pretty stupid that I can’t make this work. I’ve also tried running the script like this:
ssh -l user linuxserver /home/user/scripts/id-test.sh $REMOTE_USER
And having the script read in $1 but it’s still not passing.
Any assistance would be appreciated … thanks!