Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
How to set up default group permission in linux folder

I'm uploading to /var/www via SFTP and wondered how I can get it so when I upload a file or folder it always has the owner and group as www, and have the default chmod as 770.

I have tried this so far,

chmod 770 /var/www -R

chown www:www /var/www -R

and I have also tried

chmod u+s www -R

Currently when I upload a file the owner is the user I'm logged into and group www and chmod is 644.

anyone know how to help?

share|improve this question

marked as duplicate by Bryan, Magellan, mdpc, Iain Nov 26 '12 at 21:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

The owner of the files you upload over sftp must be the user you are using to do the upload. The resulting permissions as they land on the directory depend on the umask setting. Check it out at:

http://en.wikipedia.org/wiki/Umask

If you want to keep permissions, timestamps, etc on the "other end" you can use a parameter; in scp it's -p:

-p      Preserves modification times, access times, and modes from the
        original file.
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.