Skip to content

Runs a command in the first TTY device a user logged in, just like if the user typed it. In the background, it inserts simulated keypresses using the TIOCSTI ioctl.

License

Notifications You must be signed in to change notification settings

AlexTMjugador/ttyrun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ttyrun

Runs a command in the first TTY device a user logged in, just like if the user typed it. In the background, it inserts simulated keypresses using the TIOCSTI ioctl.

Usage

By default, ttyrun is located in /usr/bin/ttyrun, and is executable by every user (although normally only root has the necessary permissions to write to a TTY device). When it is launched, ttyrun uses the output of the who command to look for the first user logged in to a TTY, and executes a specified command on it if it finds any. ttyrun accepts two command line arguments to customize this behavior:

  • -c command: specifies the command to run on the TTY. This is passed as an argument to a /bin/sh -c call.
  • -u user: finds the first TTY that user logged in to, and uses that. If not specified, ttyrun will use the first TTY any user logged in to.

Building and packaging

This program is only composed of shell scripts, so no compilation is necessary. It should work in any GNU/Linux box that has a POSIX shell and the needed dependencies.

However, it is distributed as a .deb package that is generated with a Makefile. To create the ttyrun .deb package, you only need to make changes to the installed files, and then run:

$ make

Installation

You can get the official .deb package from the releases page. Installing the package is pretty straightforward:

# dpkg -i ttyrun_1.0-1.deb

If dpkg complains about missing dependencies, make sure you install them first.

About

Runs a command in the first TTY device a user logged in, just like if the user typed it. In the background, it inserts simulated keypresses using the TIOCSTI ioctl.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published