-2

Can someone explain this code to me? In detail why these codes were used in the code and what is the purpose of this code in the Linux system

COMMAND='/bin/sh'
sudo -u make -s --eval=$'x:\n\t-'"$COMMAND"

why this character $'x:\n\t-' ? what the meaning x: and \n and \t-?

what is the goal of this code?

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
  • First of all, do you understand `make` and how to write a makefile? Do you understand what the `-s` option do? What the `--eval` option do? Do you know about the common escape sequences for newline and tab? Have you [read the `make` manual](https://www.gnu.org/software/make/manual/)? Then think again about what `x:` might symbolize... – Some programmer dude Jan 09 '20 at 06:59
  • Unless the `sudo` part is important to the question (you want to understand the *whole* part of the command) then please post a new question with it removed. I ask you to post a new question because otherwise if you remove it from this question then the posted answer will become meaningless which isn't very nice. So if the important part of the question is only the `make` command then please post it as a new question without `sudo -u`. – Some programmer dude Jan 09 '20 at 07:25
  • 1
    This looks like a really obscure way to run a root shell; I'm guessing the obfuscation of wrapping it in `make` is trying to hide a back door. – tripleee Jan 09 '20 at 07:32

1 Answers1

0
sudo -u make -s --eval=$'x:\n\t-'"$COMMAND"

is not meaningful. sudo usage is:

sudo [-AbEHknPS] [-r role] [-t type] [-C fd] [-D level] [-g groupname|#gid] [-p prompt]
     [-u user name|#uid] [-g groupname|#gid] [VAR=value] [-i|-s] [<command>]

So, make above is the user name, and --eval is an invalid option to sudo.

Armali
  • 18,255
  • 14
  • 57
  • 171
  • While this is correct, it doesn't really answer the question itself, and would be more fitting as a comment. – Some programmer dude Jan 09 '20 at 07:15
  • 1
    @Some programmer dude - The essential question is "what is the meaning of this code". In my opinion, the appropriate answer is "It is not meaningful". – Armali Jan 09 '20 at 07:19
  • so the --eval=$'x:\n\t-' is not doing anything? – ALI JASSIM Jan 09 '20 at 12:09
  • @ALI JASSIM - The `$'x:\n\t-'` is expanded to `x:` _newline_ _tab_ `-`, but this is without effect, since the whole command is aborted. – Armali Jan 09 '20 at 13:19