0

For example, in sudo -l i discovery that I can run scp through sudo with Makulele user. I would like to know how to execute a bash command using scp. Example:

sudo -u makulele scp executeBASHcommandASmakulele 

Maybe using -S option or -p with suid flag as well... Does anyone have a way to do this?

3
  • You could use scp to copy a setuid binary and change the user, then you can execute the copied file to obtain the setuid privilege.
    – wireghoul
    CommentedFeb 7, 2017 at 4:40
  • scp doesnt support execution of comands...linux.die.net/man/1/scp
    – jmingov
    CommentedFeb 7, 2017 at 12:57
  • wireghoul catch it.CommentedFeb 7, 2017 at 22:53

1 Answer 1

1

scpdoesn't execute commands. I'm not entirely sure why you think it should.

Perhaps you want to run executeBASHcommandASmakulele on the local system as the makulele user:

sudo -u makulele executeBASHcommandASmakulele 

Or if it's a script/program in the current directory,

sudo -u makulele ./executeBASHcommandASmakulele 

Or perhaps you want to run executeBASHcommandASmakulele on a remote system as the makulele user:

sudo -u makulele ssh remote_host executeBASHcommandASmakulele 
3
  • in that case the only option I had was to execute commands by scpCommentedJul 29, 2018 at 12:47
  • You can't execute commands through scp. If that's what you think you were doing, you weren't.CommentedJul 29, 2018 at 13:51
  • In hack.me had a challenge that you need to scape from a chroot jail and one level of this jail was the 'scp' as the only disponible command. Whatever, I'm not doing hack.me challenges anymore. Thanks a lot for the reply.CommentedAug 6, 2018 at 22:21

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.