Skip to main content

Access to the PLC Shell

The Extension API enables external access to the PLC shell. For this function, a "Unix Domain Socket" is used, which the runtime system uses to receive incoming commands and send the corresponding response. The corresponding socket file is: /var/run/codesysextension/plcshell.sock

For this function, the runtime system needs to have the "Anonymous user" allowed. Allowing anonymous login is done by means of the Communication Settings of the device in the Change Communication Policy dialog (1): Allow anonymous login option (2).

_rtslext_img_anonymous_user1.png
_rtslext_img_anonymous_user2.png

Examples

Requirements

  • The runtime system has allowed the "Anonymous user".

  • You have logged in to the Linux system.

  • Your user is assigned to the codesysuser group.

Procedure. Manual access via the terminal
  • Run the following command.

    $ socat - UNIX-CLIENT:/var/run/codesysextension/plcshell.sock

    Now you can execute the commands of the PLC shell in the terminal

Procedure. Sample script
  1. Copy plcshell.py from the provided examples to the Linux system.

  2. Run the script.

    The Python script sequentially executes a series of commands using the PLC shell and demonstrates the use of the PLC shell in Python.

For more information, see: Tab: <device name> PLC Shell

Usage of the interface only as a member of the Linux codesysuser user group

Yes

Process separation

Yes