Skip to content

Instantly share code, notes, and snippets.

@Yoplitein
Created May 31, 2025 04:30
Show Gist options
  • Save Yoplitein/84484728645b97bbbdfba55d94fae23d to your computer and use it in GitHub Desktop.
Save Yoplitein/84484728645b97bbbdfba55d94fae23d to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
if [[ $# < 1 ]]; then
echo >&2 "to whom?"
exit 1
fi
user="$1"
tmuxdir="/tmp/tmux-$UID"
setfacl -dm "user:$user:rwx" "$tmuxdir"
setfacl -Rm "user:$user:rwx" "$tmuxdir"
if [[ -z "$TMUX" ]]; then
echo >&2 "\$TMUX is unset, you will need to manually run the \`server-access\` command to satisfy tmux's own access control"
exit 1
fi
tmux server-access -aw "$user"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment