Skip to end of metadata
Go to start of metadata

Description

By default the FileWave Client executes scripts and tasks with elevated permissions (root on macOS). This addition to the start of a script will execute it as the currently logged in user (also know as the console user).

Ingredients

  • Text editor

  • FileWave Admin

Directions

  1. Insert this near the start of your script, before the desired actions.


    consoleuser=`stat -f%Su /dev/console`
    sudo -u $consoleuser whoami
    Example:
    #!/bin/sh
    consoleuser=`stat -f%Su /dev/console` 
    sudo -u $consoleuser whoami
    echo "hello world" >> /Users/$consoleuser/Desktop/test.txt