I am trying to write a little SwiftUI app that connects to my server so I can display files and visually use SFTP (kind of like FileZilla). I have a function called SSH that executes on a button press, here it is:
func ssh(user: String, domain: String, password: String) {
let arg = "ssh " + user + "@" + domain
let task = Process()
task.launchPath = "/usr/bin/ssh"
task.arguments = [arg]
task.launch()
task.waitUntilExit()
}
When I call the function, I get this nasty error message in the Xcode console:
2020-11-25 11:05:35.122998-0800 SFTP App[25287:1434441] Metal API Validation Enabled
2020-11-25 11:05:49.056839-0800 ssh[25291:1434628] [] nw_resolver_can_use_dns_xpc_block_invoke Sandbox does not allow access to com.apple.dnssd.service
2020-11-25 11:05:49.057250-0800 ssh[25291:1434628] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:4 Err:-1 Errno:1 Operation not permitted
2020-11-25 11:05:49.057351-0800 ssh[25291:1434628] [connection] nw_resolver_create_dns_service_locked [C1] DNSServiceCreateDelegateConnection failed: ServiceNotRunning(-65563)
ssh: Could not resolve hostname connect.markregg.com: -65563
I am able to connect to my server using the following terminal command and then entering my password:
ssh mark@connect.markregg.com