Ras
Ras

Reputation: 547

plink: unknown option "-rf"

Thanks for looking into my concern.

I am running a command on remote linux server from windows, using plink. Here's the command I am running

echo y | plink -v -pw %Linux-pw% -P %port% %Linux-user%@%Linux-Machine% rm -rf /root/jenkins/Sandbox/project1

If I execute this command I see the below error in jenkins.

11:53:17 plink: unknown option "-rf"

Strange thing is I have the same command in two jenkins jobs. One working fine and one job is throwing this issue.

Could anyone suggest something on this.

Upvotes: 0

Views: 1228

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202108

You can get this behavior, when the %port% variable resolves to an empty string.

Then you get this:

echo y | plink -v -pw password -P user@machine rm -rf /root/jenkins/Sandbox/project1

What takes user@machine as a port number, rm as a hostname and -rf as an additional switch to Plink.


Also, never automate host key verification (echo y)!

For the correct solution see How to pass echo y to plink.exe for first connection.

Upvotes: 2

Related Questions