Deployment - Permission Denied

Answered

I'm in the process of getting PhpStorm setup and I've gotten to the deployment part and have hit a snag.  I'm embarassed to ask such a newb question, but here it is anyway...

I've gotten access to the server, and it's trying really hard to put the test files in the right place but it's getting rejected by my linux server.  If I put the path as my 'home' directory, there's no issue with deploying the file, but as soon as I put it in the web root directory, it gets denied.  I know it has to do with the sudo command such as 'sudo rm fileA' and the file is deleted, but without 'sudo' in front, the file just looks at me in defiance.  Without changing my root permission on my linux box, is there still a way to deploy to my web root directory

9 comments
Comment actions Permalink

Sorry to necro a post, but when having this same issue with WebStorm I discovered I could just change the directory owner to my username. For example, with an apache server from home dir:

sudo chown USERNAME /var/www/html

You may also like to change the need to enter a password at all as that USERNAME too:

1. sudo visudo

2. Add to the bottom of the file: (type i to insert - it's vim...)

USERNAME ALL=(ALL) NOPASSWD: ALL

(hit esc, type :x, reboot your server)*

USERNAME is that user's name e.g. bleakes

*Not recommended for large projects/multiple users (security issue)

Then go back to the InteliJ editor and, making sure the deployment path (and root path?) is set to the one you now how ownership of, hit upload for whatever file and it should upload. It does this because there is no longer any need to ask for sudo, let alone a password.

Takk

4
Comment actions Permalink

Hi Jay,

This is about executing PHP tests on server, isn't it? Can you please give more details (paths etc.)?

Thanks,
Kirill

0
Comment actions Permalink

Hey, thanks for the quick respons!

No, this is about deployment of my code from my Mac to the web server.  If I go to Tools > Deployment > Upload to... and then chose my web server, PhpStorm tries to copy my files to the web root directory (/var/www) but it fails and says 'permission denied'.  I CAN deploy files to my personal home directory '/home/jay' but only because I have full rights to that directory.  To successfully copy/move/delete files manually in the /var/www directory, I have to precede any command with 'sudo' otherwise the command fails due to permissions issues.  I guess maybe what I'm asking is whether or not it's possible that PhpStorm has the ability to include a 'sudo' command (or something equivelent) when copying to the web server. Does that make more sense?

Jay

0
Comment actions Permalink

Hi Jay,

Thanks, now it's clear. At the moment PhpStorm does not support permissons elevation, it always operates on behalf of the user/password you've entered. And I'm not sure FTP or SFTP protocols allow kind of 'sudo' execution. Anyway, feel free to submit feature request at http://youtrack.jetbrains.net/issues/WI/#newissue=yes.

Regards,
Kirill

0
Comment actions Permalink

Thanks' I've just missed that one.

0
Comment actions Permalink

Noted and voted, thanks Kirill and Dmitriy.

0
Comment actions Permalink

bleakes Thanks, brother! Awesome write up.

0
Comment actions Permalink

For Apache2 Servers, Why not just create a login for www-data which is the right-full owner of the web-root folder on Apache? or are there other issues (security) involved?

0

Please sign in to leave a comment.