summaryrefslogtreecommitdiff
path: root/setup_session_debian
blob: 0988b5ce19ee9a81c5e7142c8734aa4ed7d9aeb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Usage ./setup_session <pub_key>

chmod a+x stop_hacking_debian
cp stop_hacking_debian /bin/stop_hacking
chmod a+x continue_hacking
cp continue_hacking /bin/continue_hacking
chmod a+x invoke_session_debian
cp invoke_session_debian /bin/invoke_session

if [ $# -ne 1 ]; then
    lava-test-case public-key-installed --result fail
    exit 1
fi

mkdir -p ~/.ssh/
echo $1 >> ~/.ssh/authorized_keys
if [ $? -ne 0 ]; then
    lava-test-case public-key-installed --result fail
fi
chmod 0600 ~/.ssh/authorized_keys
echo "Public Key Installed: $1"
lava-test-case public-key-installed --result pass

/etc/init.d/ssh restart
echo "sshd re-started"
if [ $? -eq 0 ]; then
    lava-test-case sshd-restart --result pass
    echo "sshd re-started"
else
    lava-test-case sshd-restart --result fail
    echo "sshd re-start failed"
fi