GitXplorerGitXplorer
A

ttyrun

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Verified
65de08f851621c0b09a2997c37c5c38f7209a7ce

Add link to GitHub Releases

AAlexTMjugador committed 5 years ago
Unverified
f6f64d075596bacf82dfa5133c12d113e6a009cb

Move DEBIAN folder to src

AAlexTMjugador committed 5 years ago
Unverified
b6f483afb018e27f1753fd8536cc208660b41d61

Initial revision

AAlexTMjugador committed 5 years ago
Verified
d15796026dd1f764d3a4369a54ce5ffe25972afa

Initial commit

AAlexTMjugador committed 5 years ago

README

The README file for this repository.

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.