使用pscp并获得拒绝权限 [英] Using pscp and getting permission denied
问题描述
我正在使用pscp使用以下命令将文件传输到虚拟ubuntu服务器:
I'm using pscp to transfer files to a virtual ubuntu server using this command:
pscp test.php user@server:/var/www/test.php
,我得到了错误许可被拒绝.如果我尝试转移到/home/user/文件夹,则没有问题.
and I get the error permission denied. If I try to transfer to the folder /home/user/ I have no problems.
我想这与我使用的用户无权访问/var/www/文件夹有关.当我使用SSH时,我必须使用sudo来访问/var/www/路径-我可以.
I guess this has to do with that the user I'm using doesn't have access to the folder /var/www/. When I use SSH I have to use sudo to get access to the /var/www/ path - and I do.
是否可以指定pscp应该"sudo"传输到服务器,以便我可以访问/var/www/路径,并且实际上能够将文件传输到该文件夹?
Is it possible to specify that pscp should "sudo" transfers to the server so I can get access to the /var/www/ path and actually be able to transfer files to this folder?
推荐答案
如果您拥有服务器:
将自己添加到www-data组:
Add yourself to the www-data group:
sudo usermod -a -G www-data <username>
并设置正确的权限:
sudo chown -R www-data:www-data /var/www/
sudo chmod -R 0775 /var/www/
这应该可以解决问题.
This should do the trick.
这篇关于使用pscp并获得拒绝权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!