Overview

Privilege elevation enables the Delphix Continuous Data Engine to execute required operations on source, staging, and target hosts using a controlled and secure mechanism.

For connectors that require elevated permissions, you must configure a privilege elevation profile and ensure the required OS user permissions are available across all participating hosts.

Prerequisites

Make sure the following requirements are met:

  • A valid OS user exists on all connector hosts (source, staging, and target).

  • The same primary OS user is configured across hosts that share a privilege elevation profile.

  • Review the connector-specific privilege elevation requirements for your database type and version.

  • Required system utilities and database command access are available to the OS user.

  • The user has permission to execute required commands using privilege elevation (for example, sudo).

Procedure

  1. Log in to each host as an administrator.

  2. Create a new Privilege Elevation profile via CLI.

  3. Connect to the Delphix Engine and navigate to privilege elevation settings:

    # SSH to Delphix Engine
    ssh admin@<delphix-engine-ip>
    # Access CLI
    # Navigate to host configuration
    host/privilegeElevation
    # List existing profiles
    profile
    ls
    # Create a new profile for Oracle EBS
    profile create
    set name="EBS_PRIVILEGE_ELEVATION_PROFILE"
    set version=1
    commit
  4. Enter the following Privilege Elevation profile details:

    Field

    Description

    Example

    name

    Unique profile identifier

    Naming Convention

    Use descriptive names that identify the database type:

    • Oracle E-Business Suite:EBS_PRIVILEGE_ELEVATION_PROFILE

    • PostgreSQL Databases: POSTGRES_PRIVILEGE_ELEVATION_PROFILE

    • IBM Db2 Databases: DB2_PRIVILEGE_ELEVATION_PROFILE

    version Profile version number (typically 1) 1
  5. Add the following required profile scripts to the Privilege Elevation profile:

    Script Name

    Purpose

    dlpx_mount

    Mount filesystems with elevated privileges.

    dlpx_umount Unmount filesystems with elevated privileges.
    dlpx_mkdir Create directories with elevated privileges.
    dlpx_rmdir Remove directories with elevated privileges.
    dlpx_ps Process status with elevated privileges.
    dlpx_pfexec Generic command execution with elevated privileges.
    dlpx_pfexec_as_user Execute commands as alternate user with password.
    dlpx_db_exec Database-specific command execution.
  6. Create the profile scripts via Admin CLI:

    Use the Admin CLI only to create the profile script objects (set name and profile). Use curl REST API to set the script contents, as Admin CLI does not properly respect line formatting.
    # Navigate to profile scripts
    host/privilegeElevation
    profileScript
    # Create dlpx_mount script object (contents will be set via curl)
    create
    set name="dlpx_mount"
    set profile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    # Create dlpx_umount script object
    create
    set name="dlpx_umount"
    set profile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    # Create dlpx_mkdir script object
    create
    set name="dlpx_mkdir"
    set profile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    # Create dlpx_rmdir script object
    create
    set name="dlpx_rmdir"
    set profile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    # Create dlpx_ps script object
    create
    set name="dlpx_ps"
    set profile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    # Create dlpx_pfexec script object
    create
    set name="dlpx_pfexec"
    set profile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    # Create dlpx_db_exec script object
    create
    set name="dlpx_db_exec"
    set profile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    # Create dlpx_pfexec_as_user script object
    create
    set name="dlpx_pfexec_as_user"
    set profile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
  7. After creating the script objects via CLI, proceed to the REST API method below to populate script contents.

  8. Customize scripts per database type. Use curl REST API exclusively to set script contents with proper formatting preservation.

    • Oracle EBS Customizations: For Oracle EBS environments, you may need to source Oracle environment variables:

      # Enhanced dlpx_db_exec for Oracle EBS via curl
      curl --insecure -i -b cookies.txt \
        -X POST \
        -H "Content-Type:application/json" \
        https://<delphix-engine>/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
        -d '{
          "type": "HostPrivilegeElevationProfileScript",
          "contents": "#!/bin/bash\n#\n# Copyright (c) 2026 by Delphix. All rights reserved.\n#\n# Oracle EBS Database Command Execution\n\nif [ -f ~/.profile ]; then\n    . ~/.profile\nfi\n\n# Source Oracle environment\nif [ ! -z \"$ORACLE_HOME\" ]; then\n    export PATH=$ORACLE_HOME/bin:$PATH\nfi\n\n$DLPX_BIN/dlpx_pfexec \"$@\""
        }'
    • PostgreSQL Customizations

      # Enhanced dlpx_db_exec for PostgreSQL via curl
      curl --insecure -i -b cookies.txt \
        -X POST \
        -H "Content-Type:application/json" \
        https://<delphix-engine>/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
        -d '{
          "type": "HostPrivilegeElevationProfileScript",
          "contents": "#!/bin/bash\n#\n# Copyright (c) 2026 by Delphix. All rights reserved.\n#\n# PostgreSQL Database Command Execution\n\nif [ -f ~/.profile ]; then\n    . ~/.profile\nfi\n\n# Set PostgreSQL environment\nexport PATH=/usr/pgsql-<version>/bin:$PATH\n\n$DLPX_BIN/dlpx_pfexec \"$@\""
        }'
    • DB2 Customizations

      # Enhanced dlpx_db_exec for DB2 via curl
      curl -i -b cookiesnew.txt -X POST -H "Content-Type:application/json" http://"$DLPX_E_HOST"/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> -d '{"type": "HostPrivilegeElevationProfileScript","contents": "#\n# Copyright (c) 2017 by Delphix. All rights reserved.\n#\n\n#\n# This script allows customization of command execution with an alternate user\n# account.\n# Arg $1 contains \"-u<optional user account>\" for the desired user under\n# which database commands will be executed.\n# By default this argument is ignored and the script is executed as the default\n# account.\n#\n\nif [[ $1 != -u* ]]; then\n    echo \"Incorrect command line paramaters, -u<optional user account> is required as the first parameter\"\n    exit 1\nfi\nuser_id=`echo $1 | sed -e \"s\/^-u\/\/\"`\nshift 1\n#echo \"$user_id and $DB2_DB_NAME\" >> \/tmp\/test.log\nif [ -z \"$user_id\" ]; then\n\"$@\"\nelif [[ \"$user_id\" != \"delphix_os\" ]]; then\ncommand=$(printf \"%s \" \"$@\")\nsudo su - \"$user_id\" -c \"cd \/home\/\"$user_id\";export DB2DBDFT=$DB2DBDFT;$command\"\nelse\n\"$@\"\nfi"}
  9. Once the profile and scripts are created, assign it to the appropriate host via the Admin CLI:

    # Navigate to host
    host
    select <hostname>
    # Update host configuration
    update
    set privilegeElevationProfile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit

    Example Host Assignments

    # Oracle EBS Host
    host
    select ebs-prod-host.example.com
    update
    set privilegeElevationProfile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    # PostgreSQL Host
    host
    select postgres-prod-host.example.com
    update
    set privilegeElevationProfile="POSTGRES_PRIVILEGE_ELEVATION_PROFILE"
    commit
    # DB2 Host
    host
    select db2-prod-host.example.com
    update
    set privilegeElevationProfile="DB2_PRIVILEGE_ELEVATION_PROFILE"
    commit
  10. Verify profile assignment on a host.

    List all profiles

    host
    select <hostname>
    privilegeElevation
    profile
    ls

    Verify host configuration

    host
    select <hostname>
    ls
    # Output should show:
    # privilegeElevationProfile: <ASSIGNED_PROFILE_NAME>

    Verify profile scripts

    host
    select <hostname>
    privilegeElevation
    profileScript
    ls
    # Filter by profile
    # The output should show which scripts are assigned to which profile
  11. (Optional) Modify a profile script for a specific database type:

    # Navigate to profile scripts
    host/privilegeElevation/profileScript
    # Find the script ID
    ls
    # Select and update the script
    select <script-reference>
    update
    set contents="<new-script-content>"
    commit

Troubleshooting

Problem: Profile not found when assigning to host.

Solution: Verify profile name matches exactly (case-sensitive):

host/privilegeElevation/profile
ls
# Verify the exact name in the output

Problem: Profile scripts not executing.

Solution: Check the profile script contents:

host/privilegeElevation/profileScript
ls
select <script-reference>
ls
# Verify the 'contents' field is not empty

Problem: Host still using default profile after update.

Solution: Verify the assignment was committed:

host
select <hostname>
ls
# Confirm 'privilegeElevationProfile' shows the new profile name

Problem: One dataset type affected when modifying another profile.

Solution: This means profiles are correctly isolated. Verify that:

  • Each dataset type is assigned to its own profile

  • You are modifying the correct profile for the target dataset

  • No hosts are assigned to the default profile

This approach is essential for multi-database environments where multiple dataset types coexist on shared infrastructure.

Best practices

  • Use clear, descriptive names: <DATABASE_TYPE>_PRIVILEGE_ELEVATION_PROFILE.

  • Use a single, standard OS user for all hosts within the same connector workflow.

  • Avoid modifying default elevation scripts unless explicitly required.

  • Follow a least-privilege model when granting sudo access.

  • Reuse privilege elevation profiles across environments where applicable.

  • Use database-specific profiles for any customizations.

  • Always test script changes in non-production first.

Create EBS Privilege Elevation profile with All Scripts (End-to-End example)

  1. Create Profile and Script Objects via Admin CLI

    #!/bin/bash
    # Create profile and empty script objects
    ssh -T admin@dlpx-prod.example.com <<'EOF'
    # Navigate to privilege elevation
    host/privilegeElevation
    # Create EBS Profile
    profile
    create
    set name="EBS_PRIVILEGE_ELEVATION_PROFILE"
    set version=1
    commit
    # Navigate to profile scripts
    cd ..
    profileScript
    # Create all required script objects (empty, contents will be set via curl)
    create
    set name="dlpx_mount"
    set profile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    create
    set name="dlpx_umount"
    set profile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    create
    set name="dlpx_mkdir"
    set profile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    create
    set name="dlpx_rmdir"
    set profile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    create
    set name="dlpx_ps"
    set profile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    create
    set name="dlpx_pfexec"
    set profile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    create
    set name="dlpx_db_exec"
    set profile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    create
    set name="dlpx_pfexec_as_user"
    set profile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    # List all scripts to note their IDs
    ls
    EOF
  2. After creating the scripts, note their IDs from the ls output (e.g., HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-20), identify script IDs and populate contents via CURL:

    #!/bin/bash
    # Populate script contents using curl
    DELPHIX_ENGINE="dlpx-prod.example.com"
    PASSWORD="<your-password>"
    # Login
    curl --insecure -i -c cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://$DELPHIX_ENGINE/resources/json/delphix/login \
      -d "{\"type\":\"LoginRequest\",\"username\":\"admin\",\"password\":\"$PASSWORD\"}"
    # Set dlpx_mount contents
    curl --insecure -i -b cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://$DELPHIX_ENGINE/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
      -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2026 by Delphix. All rights reserved.\n#\n$DLPX_BIN/dlpx_pfexec mount \"$@\"\n"
      }'
    # Set dlpx_umount contents
    curl --insecure -i -b cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://$DELPHIX_ENGINE/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
      -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2026 by Delphix. All rights reserved.\n#\n$DLPX_BIN/dlpx_pfexec umount \"$@\"\n"
      }'
    # Set dlpx_mkdir contents
    curl --insecure -i -b cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://$DELPHIX_ENGINE/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
      -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2026 by Delphix. All rights reserved.\n#\n$DLPX_BIN/dlpx_pfexec mkdir \"$@\"\n"
      }'
    # Set dlpx_rmdir contents
    curl --insecure -i -b cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://$DELPHIX_ENGINE/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
      -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2026 by Delphix. All rights reserved.\n#\n$DLPX_BIN/dlpx_pfexec rmdir \"$@\"\n"
      }'
    # Set dlpx_ps contents
    curl --insecure -i -b cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://$DELPHIX_ENGINE/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
      -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2026 by Delphix. All rights reserved.\n#\n$DLPX_BIN/dlpx_pfexec ps \"$@\"\n"
      }'
    # Set dlpx_pfexec contents
    curl --insecure -i -b cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://$DELPHIX_ENGINE/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
      -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2026 by Delphix. All rights reserved.\n#\n$DLPX_BIN/dlpx_pfexec \"$@\"\n"
      }'
    # Set dlpx_db_exec contents
    curl --insecure -i -b cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://$DELPHIX_ENGINE/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
      -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2026 by Delphix. All rights reserved.\n#\n$DLPX_BIN/dlpx_pfexec \"$@\"\n"
      }'
    # Set dlpx_pfexec_as_user contents (complex script)
    curl --insecure -i -b cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://$DELPHIX_ENGINE/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
      -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2023 by Delphix. All rights reserved.\n#\n\n# Usage: dlpx_pfexec_as_user <username> <command and arguments>\n# Reads password from stdin\n\ntty -s && stty -echo\nread passwd\nread_status=$?\ntty -s && stty echo\n\nif [ $read_status -ne 0 ]; then\n    echo \"ERROR: Could not read password from stdin.\"\n    exit 1\nfi\n\nrun_as_user=$1\nshift 1\n\n# Get the user id. On Solaris the -u flag may not be supported by /usr/bin/id,\n# in that case we try a different binary.\nuid=\u0060/usr/bin/id -u 2>/dev/null\u0060\nif [ $? -ne 0 ]; then\n    uid=\u0060/usr/xpg4/bin/id -u\u0060\nfi\n\nrun_as_userid=\u0060/usr/bin/id -u $run_as_user 2>/dev/null\u0060\nif [ $? -ne 0 ]; then\n    run_as_userid=\u0060/usr/xpg4/bin/id -u $run_as_user\u0060\nfi\n\nif [ $uid -eq $run_as_userid ]; then\n    # If already being run by the requested user, skip sudo\n    \"$@\" 2>&1\nelse\n    # Try sudo first\n    sudo -l -S >>/dev/null 2>&1 <<EOF\n$passwd\nEOF\n\n    if [ $? -ne 0 ]; then\n        if [ \u0060uname -s\u0060 = \"SunOS\" ]; then\n            pfexec \"$@\" 2>&1 <<EOF\n$passwd\nEOF\n        else\n            echo \"ERROR: No sudo privileges or incorrect password\"\n            exit 1\n        fi\n    else\n        sudo -u $run_as_user -p \"\" -S \"$@\" 2>&1 <<EOF\n$passwd\nEOF\n    fi\nfi\n"
      }'
    echo "✓ All profile scripts populated successfully"
  3. Assign profile to target host via Admin CLI:

    ssh -T admin@dlpx-prod.example.com <<'EOF'
    # Navigate to host
    host
    # Select the EBS host
    select ebs-prod-host.example.com
    # Assign the profile
    update
    set privilegeElevationProfile="EBS_PRIVILEGE_ELEVATION_PROFILE"
    commit
    # Verify assignment
    ls | grep privilegeElevationProfile
    EOF
  4. Verify configuration:

    ssh -T admin@dlpx-prod.example.com <<'EOF'
    # Verify profile is assigned to host
    host
    select ebs-prod-host.example.com
    ls
    # Verify profile scripts
    cd privilegeElevation
    profileScript
    ls
    EOF
  5. (Recommended) Set profile script contents using CURL REST API:

    Always use curl REST API to set profile script contents. Admin CLI does not properly preserve line formatting and will corrupt script contents.

    Prerequisites:

    First, authenticate to get session cookies:

    # Login to Delphix Engine
    curl --insecure -i -c cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://<delphix-engine>/resources/json/delphix/login \
      -d '{"type":"LoginRequest","username":"admin","password":"<password>"}'

    Standard profile Curl scripts

    dlpx_mount

    curl --insecure -i -b cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://<delphix-engine>/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
      -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2026 by Delphix. All rights reserved.\n#\n$DLPX_BIN/dlpx_pfexec mount \"$@\"\n"
      }'

    dlpx_umount

    curl --insecure -i -b cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://<delphix-engine>/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
      -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2026 by Delphix. All rights reserved.\n#\n$DLPX_BIN/dlpx_pfexec umount \"$@\"\n"
      }'

    dlpx_mkdir

    curl --insecure -i -b cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://<delphix-engine>/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
      -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2026 by Delphix. All rights reserved.\n#\n$DLPX_BIN/dlpx_pfexec mkdir \"$@\"\n"
      }'

    dlpx_rmdir

    curl --insecure -i -b cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://<delphix-engine>/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
      -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2026 by Delphix. All rights reserved.\n#\n$DLPX_BIN/dlpx_pfexec rmdir \"$@\"\n"
      }'

    dlpx_ps

    curl --insecure -i -b cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://<delphix-engine>/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
      -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2026 by Delphix. All rights reserved.\n#\n$DLPX_BIN/dlpx_pfexec ps \"$@\"\n"
      }'

    dlpx_pfexec

    curl --insecure -i -b cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://<delphix-engine>/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
      -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2026 by Delphix. All rights reserved.\n#\n$DLPX_BIN/dlpx_pfexec \"$@\"\n"
      }'

    dlpx_db_exec

    curl --insecure -i -b cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://<delphix-engine>/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
      -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2026 by Delphix. All rights reserved.\n#\n$DLPX_BIN/dlpx_pfexec \"$@\"\n"
      }'

    dlpx_pfexec_as_user

    curl --insecure -i -b cookies.txt \
      -X POST \
      -H "Content-Type:application/json" \
      https://<delphix-engine>/resources/json/delphix/host/privilegeElevation/profileScript/HOST_PRIVILEGE_ELEVATION_PROFILE_SCRIPT-<id> \
      -d '{
        "type": "HostPrivilegeElevationProfileScript",
        "contents": "#\n# Copyright (c) 2023 by Delphix. All rights reserved.\n#\n\n# Usage: dlpx_pfexec_as_user <username> <command and arguments>\n# Reads password from stdin\n\ntty -s && stty -echo\nread passwd\nread_status=$?\ntty -s && stty echo\n\nif [ $read_status -ne 0 ]; then\n    echo \"ERROR: Could not read password from stdin.\"\n    exit 1\nfi\n\nrun_as_user=$1\nshift 1\n\n# Get the user id. On Solaris the -u flag may not be supported by /usr/bin/id,\n# in that case we try a different binary.\nuid=\u0060/usr/bin/id -u 2>/dev/null\u0060\nif [ $? -ne 0 ]; then\n    uid=\u0060/usr/xpg4/bin/id -u\u0060\nfi\n\nrun_as_userid=\u0060/usr/bin/id -u $run_as_user 2>/dev/null\u0060\nif [ $? -ne 0 ]; then\n    run_as_userid=\u0060/usr/xpg4/bin/id -u $run_as_user\u0060\nfi\n\nif [ $uid -eq $run_as_userid ]; then\n    # If already being run by the requested user, skip sudo\n    \"$@\" 2>&1\nelse\n    # Try sudo first\n    sudo -l -S >>/dev/null 2>&1 <<EOF\n$passwd\nEOF\n\n    if [ $? -ne 0 ]; then\n        if [ \u0060uname -s\u0060 = \"SunOS\" ]; then\n            pfexec \"$@\" 2>&1 <<EOF\n$passwd\nEOF\n        else\n            echo \"ERROR: No sudo privileges or incorrect password\"\n            exit 1\n        fi\n    else\n        sudo -u $run_as_user -p \"\" -S \"$@\" 2>&1 <<EOF\n$passwd\nEOF\n    fi\nfi\n"
      }'

 

Last updated
Oct 9, 2026