2013-05-19 42 views

回答

6

如果您的计算机访问互联网,这 - 尽管如此 - 应该工作;

scp (filename) `echo $SSH_CLIENT | awk '{print $1}'`:(location on my computer) 

的更简单的方法(即永久有效)是做一个新窗口,SCP的本地计算机上,而不是;

scp (remote computer):path/to/remote/file (location on my local computer) 

remote computer与您通常ssh到的地址相同。

举个例子,如果该文件是在远程计算机上名为important你的主目录的子目录叫做remotecomputer.com和文件名为test.txt,你可以在本地计算机上发出此命令将其复制到当前目录在本地计算机上;

scp remotecomputer.com:important/test.txt . 
+0

。出于某种原因,它不会起作用。 – Mechy

+0

我如何知道要在泡泡中放置什么(本地计算机)? – Mechy

+0

那么,问题是我不知道如何做路径。我试过类似/ home/usernamefolder /(myfile),但由于某种原因无法找到darn文件。当你做道路时,你从哪里开始? – Mechy

8

scp实际上比乍一看更容易使用。

scp <from> <to>

<from><to>可以是本地的或远程的。

远程文件的形式为[email protected]:path_on_remote

本地文件只是简单路径:/path/to/my/file.txt

如果你是手工做这个,你可能会发现更容易不将文件复制到您的办公机器,通过运行之前从本地主机以下被登录到远程主机:

scp [email protected]:/path/to/my/file/on/remote.txt /local/path/local.txt

如果您需要复制目录 - 如前所述 - 您可以给予scp -r选项。

登录到远程时,复制回来基本上是一样的,虽然你需要在本地机器上运行ssh,这可能需要在本地路由器上进行端口转移。我倾向于更容易在我的笔记本电脑上将scp拨打到服务器,而不是其他方式。

0

与PEM文件(PEM文件必须位于根)

$ scp -i <pem.pem> <file_on_local> <user>@<remotehost>:/path/to/file 

与我有麻烦,虽然找出路径凭据

$ scp <file_on_local> <user>@<remotehost>:/path/to/file 
相关问题