Allow All Applications
  • 17 Jan 2025
  • 1 Minute to read
  • PDF

Allow All Applications

  • PDF

Article summary

The following script helps IT Admins allow all the Linux machine applications.

  1. Copy and save the contents below to a UTF-8 editor like notepad++ OR Sublime Text in Windows or gedit in Ubuntu.

    1. If you are using notepad++ then use the bottom right panel to change the type to Unix (LF).

  2. Or, click here to download the file.

    cat << EOF | sudo tee /etc/xdg/autostart/allowed_apps_daemon.desktop
    [Desktop Entry]
    Type=Application
    Exec=/usr/local/sbin/allowed_apps_daemon.sh
    Hidden=false
    NoDisplay=false
    X-GNOME-Autostart-enabled=true
    Name=My Daemon
    Comment=Start allowed apps daemon
    EOF
    
    cat << EOF | sudo tee /usr/local/sbin/allowed_apps_daemon.sh
    #!/bin/bash
    # No blocking or killing of processes required anymore
    TARGET_USER=\$(whoami)
    
    # The script simply loops without terminating processes
    
    while true; do
      # Get the list of running processes for the target user
      running_processes=\$(ps -u "\$TARGET_USER" -o pid=,cmd=)
    
      # Output all running processes (this won't kill anything)
      echo "Running processes for user \$TARGET_USER:"
      echo "\$running_processes"
    
      # Pause for 30 seconds
      sleep 30
    done
    EOF
    
    # Make the script executable
    chmod 755 /usr/local/sbin/allowed_apps_daemon.sh
    
    # Allow the script to be run without a password prompt for sudo
    visudo_entry="ALL ALL=(ALL) NOPASSWD: /usr/local/sbin/allowed_apps_daemon.sh"
    echo "$visudo_entry" | sudo tee -a /etc/sudoers
    
    # Verify the sudoers file syntax
    sudo visudo -c
    
    # Please reboot the device once the script is executed
    EOF
  3. Follow our guide to upload & publish the script using Scalefusion Dashboard.

Note:

  1. Some of the scripts and their contents are sourced from internet and yes, our new friend ChatGPT.

  2. Please validate the scripts on a test machine before deploying them on all your managed devices.

  3. Scalefusion has tested these scripts, however Scalefusion will not be responsible for any loss of data or system malfunction that may arise due to the usage of these scripts.


Was this article helpful?