I'm using NMSSH in Swift in my app. I've successfully connected and able to execute commands. My question is fail to pass password when using scp and the password prompt. The relevant code is as below. Thanks all for answering.
var commands = ["scp filePath/filename username@xxx.xxx.xx.xx:~/testFromiPhone.txt","mypassword"]
func executeCommand() {
let error: NSErrorPointer = nil
for command in commands {
sshQueue?.sync {
var response: String?
print("command: \(command)")
response = self.session?.channel.execute(command, error: error, timeout: 10)
print("response: \(response ?? "no response")")
}
}
}
What I'm trying to do is allow other users to SCP their file to my server. The session is connected to their client/server and username@xxx.xxx.xx.xx is mine. I hope to do the least change on their end.