34

I am using WinSCP and keep on experiencing this error every time I try to replace/overwrite a file. I have been able to transfer/overwrite a file before with out any problem but not anymore.

The exact error message:

Cannot create remote file 'var/lib/tomcat6/webapps/..../myfilename.filepart'.
Permission denied.
Error code: 3
Error message from server: Permission denied

I have tried changing the ownership which I was successful at because when I refreshed, from tomcat6, it is now under my login name. But I am still denied. This is giving me a very hard time testing our reports as I just need to see if it's already working i n the deployed app.

I also tried tweaking some of the options in the WinSCP preferences such as Drag & Drop and Endurance but nothing made any difference.

I reinstalled PuTTY and WinSCP, but nothing changed.

I am able to replace my file by coming out 1 notch from the file path (ex. var/lib/myfolder/myproject/web-inf/report, back 1 notch to var/lib/myfolder/myproject/web-inf/) then type

sudo chown myuser:myuser report -R

but my reports will have errors, so I had to type sudo chown tomca6:tomcat6 report -R then the error will be cleared and I now can view my replaced file.

This is very inconvenient as I have to do this every time. Is there anything I can do to fix this? thanks

Neuron
  • 5,141
  • 5
  • 38
  • 59
user742102
  • 1,335
  • 8
  • 32
  • 51
  • Answer might be closed but the problem still persist, for me using free tier from cloud providers will not give you root access, to fix this you have to change folder permission from SSH or try this solution https://stackoverflow.com/a/74067001/2416688 – Subramanya Rao Oct 14 '22 at 09:15

1 Answers1

27

You possibly do not have create permissions to the folder. So WinSCP fails to create a temporary file for the transfer.

You have two options:

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • 19
    As per first option you need to run this command in your folder `sudo chown -R ubuntu:ubuntu .` on your server if ubuntu is the user. –  Dec 23 '17 at 06:35
  • 9
    sudo chown -R -v ec2-user /var/app/current/ –  Aug 22 '18 at 17:57