londonfed
londonfed

Reputation: 1230

Chown directory via SSH on server using NPM script

I am trying to chown a directory via an NPM script. The script looks like the following:

chown -R 755 www-data [email protected]:/var/www/test.com

But the message I get back is: chown: www-data: No such file or directory even though this exists. Any ideas much appreciated.

Upvotes: 1

Views: 2170

Answers (2)

JoshuaRLi
JoshuaRLi

Reputation: 1735

chown operates locally, not on remote servers. In your example, chown is attempting to operate on ./www-data and ./[email protected]:/var/www/test.com, which don't exist in the directory of wherever you were when you executed the command.

You will need to execute chown as a command through ssh:

ssh [email protected] chmod -R 755 /var/www/test.com/

Upvotes: 3

londonfed
londonfed

Reputation: 1230

Fixed this with following script.

ssh [email protected] chmod -R 755 /var/www/test.com/

(I needed to login to the server first).

Upvotes: 0

Related Questions