Today's article is a bit more complicated - and has you disabling specific terminal commands...

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
11,497
Reaction score
9,994
Credits
95,326
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.


Enjoy!
 


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.


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!
 
Last edited:
Darn it... I'd forgotten the backslash!

Good call - and will amend the article when I get a minute. (I'll change the verbiage to something about hiding the command and making it more difficult.)

I had completely forgotten the backslash.
 


Latest posts

Top