我试图通过特定的网卡执行 scp 。
我阅读了SCP 手册页,但找不到所需的标志。
我正在阅读一些通过 SSH 客户端发送文件的 Go 代码。
https://github.com/tmc/scp/blob/master/scp.go#L33
它所做的一件事是将scp -t /remote/path. 那-t旗子是干什么用的?我做了一个man scp,但似乎没有记录。我在本地运行了命令,它的行为似乎像 cat。
scp -t远程运行后,代码会像这样将字节发送到服务器。
// Some special control header? What is this?
fmt.Fprintf(w, "C%#o %d %s\n", mode, size, fileName)
// Send file bytes.
io.Copy(w, contents)
// Send termination signal?
fmt.Fprint(w, "\x00")
Run Code Online (Sandbox Code Playgroud)
这个协议是什么?它在任何地方都有记录吗?
我现在已经浪费了一个多小时,我认为这应该很简单......
我有一个 azure 网站,它允许我使用 sftp 连接和部署到它。我可以使用 FileZilla 通过以下设置很好地连接到它:
不过,我不想使用 FileZilla 连接到它。我想使用命令行移动文件。我一直在尝试使用sftp,ftp并scp均无功而返。最后,他们都失败了:
$ sftp -v -oPort=990 user@xxxxx.ftp.azurewebsites.windows.net
OpenSSH_7.9p1, OpenSSL 1.0.2r 26 Feb 2019
debug1: Reading configuration data /home/rg/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 17: Applying options for *
debug1: Connecting to xxxxxxx.azurewebsites.windows.net [xxx.xxx.xxx.xxx] port 990.
debug1: Connection established.
debug1: identity file /home/rg/.ssh/id_rsa type 0
debug1: identity …Run Code Online (Sandbox Code Playgroud) sudo使用以下命令连接到 SFTP 服务器后,我需要用户“admin”。
sftp user@hostname
sftp> sudo su - admin
Invalid command.
Run Code Online (Sandbox Code Playgroud)
我还有其他方法可以使用吗sudo?