How to copy files to a network path
I wnated to copy file form my local drive to network path. I know how this
can be achieved by using ssh ftp library i.e using sftp.put(@ local,
remote) , but i don't know how do do by using "sudo". What to do in case i
don't have write permission to network path.
Although i can remove file from network path by using following code :
string username = ConfigurationManager.AppSettings.Get("username");
string pass = ConfigurationManager.AppSettings.Get("password");
string filename;
filename = "standalone-full.xml";
string directory1;
directory1 = "apps/instances/express_13000/configuration";
// connecting to machine
SshExec ssh = new SshExec("machine", "user");
ssh.Password = "password";
ssh.Connect();
Console.WriteLine("Connection Established");
// removing files from server
string command_express = "echo" + "'" + pass + "'" + "| sudo -S -u
wtsnqa " + "/" + directory1 + "/" + filename + "-exec rm";
string output1 = ssh.RunCommand(command_express);
No comments:
Post a Comment