使用SSH登录上传文件到服务器的方法

技术问题

使用SSH登录上传文件到服务器的方法

2024-06-12 09:14


使用SSH登录上传文件到服务器的方法

                                            




现在服务器linux很多。是不是不会传文件?别急 下面就是方法:

 

一、上传文件到linux服务器

 

首先从你本地切换到你要上传文件的目录,接下来:

 

scp 文件名字 服务器用户名字@服务器ip:目录

 

例子:

 

scp index.html root@58.87.124.110:/home/service-tomcat/webapps/

 

二、上传文件夹到linux服务器

 

同文件上传只是在文件名字前面加上-r

 

例子:

 

scp static/ root@58.87.124.110:/home/service-tomcat/webapps/

 

需要注意:

 

    1、要在要上传文件的前面加-r,否则报错

 

static: not a regular file

-r: No such file or directory

 

    2、要上传文件后面最好加/


標簽:
  • 使用SSH登录上传文件到服务器的方法