Run Shell Command

Last modified by Vincent Massol on 2021/03/18 11:29

application_osx_terminalAllows users with programming permission to run a command on the bash shell on the server
Developed by


0 Votes
LicenseGNU Lesser General Public License 2.1

Table of contents


 Only works on a server with Linux. 

Security: None (no protection against cross site request forgery, this should be removed after use.)

This script can create processes which do not stop, it's up to you to then find and kill the processes.

if (xwiki.hasAccessLevel("programming", xcontext.getUser(), "XWiki.XWikiPreferences")) {
  String shellcmd = request.getParameter("command");
  println("{{html}}<form action='' method='POST'><input type='text' name='command' size=50 />");
  println("<input type='submit' value='Run' /></form>{{/html}}\n\n")
if (shellcmd != null ) {
    String[] cmd = ["sh", "-c", shellcmd];
    stdout = new
    println("{{code language=none}}")
  while ((s = stdout.readLine()) != null) {

Get Connected