The first user to come with an elegant and secure solution, which solves this problem gets 10$ and the highest ratings. Please create a [url removed, login to view] username and provide it together with your solution.
I have an Amazon ec2 linux server. Root login is disabled (I do not want to enable this), and instead the username I log in with is ec2-user. From EC2-user I can write su root to get root access.
I have a PHP application running on the server. This PHP application requires that the user "apache" is the owner of the files in that directory. My problem is that I would like to edit these files in WinSCP. WinSCP can only log in using EC2-user, which is not the owner of these files. My solution right now is is to run
chown -R ec2-user phpapp/
When I need to edit and then
chown -R apache phpapp/
When I am finished.