This one has quite a bit to it. I've been wanting to actually talk about aliases for a while, but it's a longer article than normal and a bit advanced for the newer users (though it was something I latched onto early). I proofed it a couple of times, hoping that I got all the necessary stuff out there. It ended up pretty long.
In today's article, we're going to learn how to disable specific terminal commands. It'll be an interesting article
linux-tips.us
Enjoy!
Aliasing a command to an empty string won’t prevent a user from running the command. They can simply escape the alias using a backslash!
Running with your
uptime
example:
Even if you aliased uptime to echo a fake error message, like "bash: uptime: command not found", to try to fool people. My first port of call would be to try
which uptime
, to check if it was installed or not.
And if it was, I’d see something like
/usr/bin/uptime
, which would immediately make me suspicious. Then I’d use the command
type uptime
, which would tell me that uptime had been aliased to an echo command, which prints a fake error message from bash.
So then I’d run
\uptime
, in order to bypass/escape the alias and run the actual uptime command.
So aliasing is NOT a way to disable commands!