Skip to content

Bash: Create a simple script to print the current user

Michael Watts edited this page Dec 2, 2015 · 2 revisions

Create a simple script to print the current user (note the cool cat hack to save opening an editor):

export STICKY_FILE="/$HOME/setuid-test.sh"
cat > $STICKY_FILE << EOF
herdoc: #!/bin/bash
herdoc:echo "They call me..."
herdoc:whoami
herdoc:EOF

Make it executable:

chmod 755 /$HOME/setuid-test.sh

Test it

$STICKY_FILE
They call me...
michaelwatts

source: https://www.youtube.com/watch?v=1H3Jf1X8rwI

SSH

2 Best practices when logging in remotely to linux machine

WARGAMES

Clone this wiki locally