when I connect to server with SSH.NET library, the default folder is /mif/stud3/2014/rira1874
. When I execute
res = ssh.CreateCommand("cd existingFolder").Execute();
Console.WriteLine(res);
it still stays in default connection folder. What's wrong here?
full code:
public void ConnectWithPassword(string username, string password, string domain, int port)
{
bool i = true;
using (var ssh = new SshClient(CreatePasswordConnectionInfo(username, password, domain)))
{
try
{
ssh.Connect();
if (ssh.IsConnected)
{
while(i == true)
{
string res = Regex.Replace(ssh.CreateCommand("pwd").Execute(), @"\r\n?|\n", "");
Console.Write(res + ": ");
res = ssh.CreateCommand(Console.ReadLine()).Execute();
Console.WriteLine(res);
}
}
else {
Console.WriteLine("Not connected");
}
ssh.Disconnect();
}
catch (Exception e)
{
Console.WriteLine("Exception caught: {0}", e);
}
}
}