Using pscp and getting permission denied

前端 未结 3 1325
后悔当初
后悔当初 2021-02-05 05:40

I\'m using pscp to transfer files to a virtual ubuntu server using this command:

pscp test.php user@server:/var/www/test.php

and I get the erro

相关标签:
3条回答
  • 2021-02-05 06:07

    I had the same error "pscp: unable to open YourFilePath: permission denied",

    check the ownership of the file you are trying to overwrite, you will get this error if you can't overwrite it,

    If you don't have control over the remote file, just simply try to rename the file you are trying to move.

    0 讨论(0)
  • 2021-02-05 06:11

    If you own the server:

    Add yourself to the www-data group:

    sudo usermod -a -G www-data <username>
    

    And set the right permissions:

    sudo chown -R www-data:www-data /var/www/
    sudo chmod -R 0775 /var/www/
    

    This should do the trick.

    0 讨论(0)
  • 2021-02-05 06:29

    Beware of the following that when you write

    sudo usermod -G www-data <username>
    

    The option -G will make the specified user () a member of the particular group(s) that are specified. So the above statement will make the user a part of group www-data BUT will remove the user from any other group that the user belongs to. To avoid this you must either add the option -a or specify all the current groups that you want the user to be a part of. I accidently took the user "administrator" out of the sudo group because I didn't know this. So if you want the specified user to keep it's current group membership then write the following command.

    sudo usermod -G -a www-data <username>
    

    For more info regarding the usermod command, visit:

    Ubuntu manpages - usermod

    0 讨论(0)
提交回复
热议问题