1. Home
  2. SureMDM
  3. How To Remotely Execute Shell Commands On Linux?
  1. Home
  2. Linux Management
  3. How To Remotely Execute Shell Commands On Linux?

How To Remotely Execute Shell Commands On Linux?

KB ID: 42G2004859
Total Views: 383

SureMDM is a multi-platform, a UEM solution that supports remote management of Linux devices. You can remotely execute Linux shell commands to perform variety of actions such as:

– Installing applications

– Creating and Deleting directory

– Creating and Deleting files

– Configuring  read/write/execute permissions to files

– moving files between folders

Executing Linux shell commands requires creating a Run Script job in SureMDM Web Console and applying it to the device. 

Steps to create and apply a Run Script job to a Linux device

1. Login to SureMDM Web Console.

2. Click Jobs.

3. Click New Job and then select OS as Linux.

4. Click Run Script.

5. On the Run Script prompt, enter run scripts and click on Save.

6. Go to SureMDM Home, select the desired Linux device and click on Apply.

7. On the Apply Job To Device prompt, select the job and click on Apply.

Note: All the Shell commands that support Linux can be used in SureMDM Run Script job as well.


Some sample scripts which can be used to perform actions

1. Create file

#!/bin/bash
cd /home/ubuntu
cat >File.txt

2. Make directory:

#!/bin/bash
cd /home/ubuntu
mkdir Folder_Name

3. Move file from one folder to other:

#!/bin/bash
cd /home/ubuntu
mv Folder_1 Folder_2

4. Remove file (Example- TeamViewer):

cd /home/ubuntu
rm -r File_Name

5. To install the application:

#!/bin/bash
sudo sh -c "echo y | sudo apt-get -f install
sudo sh -c "echo y | sudo apt-get install gdebi
sudo wget https://download.teamviewer.com/download/linux/teamviewer_amd64.deb
sleep 10
sudo sh -c "echo y | dpkg -i teamviewer_amd64.deb"
sleep 5
sudo apt-get install

6. Get Permission pop up to grant access for Remote support:

!#suremdm
AskAdminRSPermission(true)

Run Script feature is supported on other OS platforms as well. To explore this feature for Android and iOS devices, click here.

For a free trial for SureMDM, register here.

Updated on July 16, 2020

Was this article helpful?

Related Articles