SSH SCP Local file to Remote in Terminal Mac Os X

前端 未结 3 1479
走了就别回头了
走了就别回头了 2021-01-29 21:55

I am attempting to copy a local file \'magento.tar.gz\' from my local machine to a remote server using SSH through a VPN. This is connecting to the Virtual Machine\'s Internal I

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-29 22:26

    At first, you need to add : after the IP address to indicate the path is following:

    scp magento.tar.gz user@xx.x.x.xx:/var/www
    

    I don't think you need to sudo the scp. In this case it doesn't affect the remote machine, only the local command.

    Then if your user@xx.x.x.xx doesn't have write access to /var/www then you need to do it in 2 times:

    Copy to remote server in your home folder (: represents your remote home folder, use :subfolder/ if needed, or :/home/user/ for full path):

    scp magento.tar.gz user@xx.x.x.xx:
    

    Then SSH and move the file:

    ssh user@xx.x.x.xx
    sudo mv magento.tar.gz /var/www
    

提交回复
热议问题