lanssh is a command-line utility that allows you to SSH into local network (LAN) devices using simple aliases instead of IP addresses. It internally resolves the IP address using the MAC address associated with each alias, thus eliminating the need to remember or look up dynamic IP addresses of known hosts.
This tool is ideal for network setups involving devices such as Raspberry Pi boards, home servers, or other computers with dynamic IPs but static MAC addresses. lanssh wraps around OpenSSH (ssh) and simplifies the workflow for accessing LAN hosts.
- Alias-based SSH login: SSH into LAN hosts using predefined alias names instead of IP addresses.
- MAC-to-IP resolution: Resolves the IP of a host dynamically at runtime based on MAC address.
- Persistent alias database: Stores mappings in
~/.lanssh/db.jsonfor reuse across sessions. - Custom default user per host: Specify a default user for each alias for ease of use.
- Database management: Add, remove, list aliases, and clear the entire database.
- Static MAC reliance: Works as long as the target device has a static MAC address.
- Currently supports Linux-based systems only.
- Debian "Bookworm"
- Android 12 (Termux)
Currently, installable packages are available for Debian-based disributions only. Manual installation is possible via make for others.
You can install lanssh using the APT package manager from the official GitHub-hosted stable repository.
- For Termux, run:
export TERMUX_ROOT="$HOME/../usr"
mkdir -p $TERMUX_ROOT/etc/apt/sources.list.d
echo "deb [trusted=yes arch=all] https://arijitkd.github.io/lanssh/packages/apt stable termux" | tee $TERMUX_ROOT/etc/apt/sources.list.d/lanssh.list- For other Debian-based distributions, run:
echo "deb [trusted=yes arch=all] https://arijitkd.github.io/lanssh/packages/apt stable main" | sudo tee /etc/apt/sources.list.d/lanssh.list
trusted=yesis used here because the repository is not signed with a GPG key.
- For Termux, run:
pkg update- For other Debian-based distributions, run:
sudo apt update- For Termux, run:
pkg install lanssh- For other Debian-based distributions, run:
sudo apt install lansshIf you prefer, you can manually download and install the .deb package from the Releases section of the GitHub repository.
Visit: https://github.com/ArijitKD/lanssh/releases
Download the latest .deb file corresponding to your architecture (usually amd64 for most systems).
sudo dpkg -i lanssh_<version>_all.debReplace
<version>with the actual version number of the downloaded package.
sudo apt install -fInstall make and git if you don't have it already. Installation procedure may vary depending on your package manager. Consult your system documentation for guidance.
In your preferred workspace directory, run:
git clone https://github.com/ArijitKD/lanssh.git lanssh-mainRun as root:
cd lanssh-main
make installTo uninstall, assuming you are in the toplevel directory of the repository (lanssh-main as per above), run as root:
make uninstalllanssh <alias> [-u <username>]If the -u option is not specified, the default user saved during alias registration is used.
lanssh --add-alias <alias> <mac-address> <default-user>lanssh --rm-alias <alias>lanssh --rmdblanssh --list [--format <table|json>]lanssh --helplanssh --versionStored at ~/.lanssh/db.json, the alias database follows this JSON structure:
{
"aliases": [
{
"name": "pi",
"mac": "dc:a6:32:xx:xx:xx",
"default_user": "pi"
}
]
}Manual editing is discouraged unless recovery is necessary.
- python3
- iproute2
- iputils-ping
- openssh-client
For manual installation using make, ensure these packages are installed. Note that package name may differ by distro, and the actual programs required are:
- python3
- ip
- ping
- ssh
lanssh follows the UNIX design philosophy:
- Each function and subroutine does exactly one job.
- No dynamic typing or duck-typing abuses — types are consistent and explicit.
- Functions are deterministic and side-effect free unless absolutely required.
- Errors are traceable and reported meaningfully.
This utility is meant to behave like a part of GNU coreutils — dependable, scriptable, and straightforward.
This software is licensed under the GNU General Public License v3+.
You may redistribute and/or modify it under the terms of the GPL.
There is no warranty, express or implied.
For more details, see LICENSE.
Arijit Kumar Das
Email: arijitkdgit.official@gmail.com
Contributions, bug reports, and suggestions are welcome. Please adhere to UNIX programming principles while contributing.
For a condensed and structured reference, see the manual page after installation:
man lanssh