在将本地文件夹上传到云服务器之前,你需要先连接到你的云服务器。这通常涉及到ssh连接。以下是一个简单的步骤指南:
安装SSH客户端软件。如果你使用的是Windows系统,你可以使用PuTTY。如果你使用的是Mac/Linux系统,你可以直接使用SSH命令行工具。
生成SSH密钥对。打开一个终端窗口,然后输入以下命令:
ssh-keygen -t rsa -b 4096
按照提示操作,直到出现"Enter a file in which to save the key (/Users/your_username/.ssh/id_rsa): ",然后按回车键。这个过程会生成两个文件:id_rsa和id_rsa.pub。这两个文件将在后续步骤中用到。
登录到你的云服务器。输入以下命令:
ssh your_username@your_server_ip
输入你的用户名和密码。如果一切正常,你会看到类似以下的输出:```Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-107-generic x86_64)
Documentation: https://help.ubuntu.com
Management: https://landscape.canonical.com
Support: https://ubuntu.com/advantage
System information as of Wed Aug 18 ABT 2021 17:31:44 +0CDT
System load: 0.0 Users logged in: 0Usage of /: 1.3% of woody IP address for eth0: 10.X.X.XMemory usage: ∼1.4% IP address for docker0: 172.X.X.XSwap usage: 0%
Graph this data and manage this system at: https://landscape.canonical.com/
Get cloud support with Canonical Livepatch Service https://www.ubuntu.com/livepatch
0 packages can be updated.0 updates are security updates.
The programs included with the Ubuntu system are free software;the exact distribution terms for each program are described in theindividual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted byapplicable law.
To run a command as administrator (user "root"), use "sudo ".See "man sudo_root" for details.
your_username@your_server_ip's password:
4. 现在,我们将把你的本地文件夹上传到云服务器上。首先,进入到你要上传的目录:
cd path/to/directory```
接下来,我们使用SFTP客户端(如FileZilla)或者SSH命令行工具将该目录上传到云服务器上。这里我们以FileZilla为例:
在FileZilla中,点击“站点”->“添加站点”,输入你的服务器信息(主机名、端口、用户名和密码)。
选中刚刚添加的站点,然后点击右侧的“传输”按钮。
在弹出的对话框中,勾选“使用被动模式”(PASV),然后点击“确定”。
这时,FileZilla应该会显示出一个用于上传文件的对话框。找到你在第4步中指定的目录,然后选择要上传的所有文件,最后点击“上传”即可。
现在,你已经成功地将本地文件夹上传到了云服务器上。你可以使用ls命令查看上传后的文件。