0

I'm using SshClient from Renci.SshNet and i have noticed that all the commands are not effective on the remote server.

For example, that one works fine :

mySSH.RunCommand( "touch test");

will create a file on the remote server.

but this one won't do anything :

mySSH.RunCommand( "nohup dnx web &");

I searched all over the internet and i'm so disapointed cause nobody talk about that.

Mostly, all commands that are simple like create a file or a folder, but strong commands like executing a script or starting my application (the most important) just simply don't want to do anything.

Thank you in advance.

Aymeric
  • 11
  • 5

1 Answers1

0

Can you run this command when you log in over ssh as the same user Ssh.Net is using?

Dan O'Leary
  • 2,660
  • 6
  • 24
  • 50
  • have you tried running 'file.sh' without 'bash' in front of it? – Dan O'Leary Jan 21 '16 at 14:02
  • 1
    Yes for both. Everything work when i'm on ssh session from putty for example. The command 'bash' was an example. If i do chmod +x on my .sh file and then i try executing ./file.sh that wont work. Also, many commands don't works at all – Aymeric Jan 21 '16 at 14:38
  • It might be worth trying the approaches in this question: http://stackoverflow.com/questions/7141841/passing-parameters-to-bash-when-executing-a-script. i.e. using CreateCommand and Execute, or using curl – Dan O'Leary Jan 21 '16 at 15:26
  • I will try by this way thank you, and i will report here what i have done. – Aymeric Jan 22 '16 at 09:36
  • I don't understand anything from this topic. First, i don't see what the point of using curl here, i don't have any url to pass to it. Then, i tryed to load in a string from a file what i want to do, like the person in the other topic : cmd = client.CreateCommand(string.Format("sh -x -s < {0}", script)); but that don't even work. I don't think you really got my problem. – Aymeric Jan 22 '16 at 16:27
  • I just want to add more information, i can run "sh script.sh", but only commands like touch or mkdir can be used. I can't use screen, or dnx (the most important here). – Aymeric Jan 22 '16 at 16:59