Quantcast
Channel: Fedora People
Viewing all articles
Browse latest Browse all 29900

mythcat: Protect your root account.

$
0
0
I will present a solution to protect the root account, quite funny but still elegant.
You can read about the command trap using : man trap.
What is this command?
when the specified event will occur will execute the command specified.
In this case, it will receive signal respectively will execute one command - exit
The the source code.

protect()
{
echo "What is the secret ?"
trap protect 2 20
read -s resp
if [ "$resp" != "asd" ]; then
echo "Error!"
exit
fi
}
protect
The result will be leaving the root account if you do not answer the question correctly.
Now protect the file against unauthorized changes:
# chmod 700 /root/.bashrc
You can create using the example above, different ways to execute various commands.

Viewing all articles
Browse latest Browse all 29900

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>