Skip to content

Instantly share code, notes, and snippets.

View tsia's full-sized avatar

tsia tsia

View GitHub Profile
@AnthillBeetle
AnthillBeetle / remember_command
Last active March 6, 2017 22:18
Remember first requested command for the SSH key and refuse to run if command changes.
#!/bin/bash
set -euo pipefail
if [[ $# -ne 1 ]] || [[ "$1" == '--help' ]]; then
cat >&2 <<'EOF'
Insert the following before a key in .ssh/authorized_keys:
command=".ssh/remember_command ID",no-agent-forwarding,no-port-forwarding,no-X11-forwarding,no-user-rc,no-pty
(On newer systems you can replace all these no-* options with single "restrict".)
Put this script into your ~/.ssh/ directory and make it executable.
It will remember the first requested command for the specified ID,
@nilsding
nilsding / .bashrc
Last active April 23, 2017 15:04
The Windows user friendly .bashrc™
# The Windows user friendly .bashrc™
# (c) 2013-2014 nilsding
# License: public domain
# Feel free to fuck around with this.
# Test for an interactive shell.
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi