Reputation: 4918
For example, i want a file has permission of 644 automatically when i uploaded it to my linux host, before upload, it is under windows. How could i do this?
Btw, i use Filezilla for upload
Updated: Before post this question, actually, i ever thought it is impossible too. But, as i has many wordpress sites, i remembered that i never need to set permission for wordpress files. So i did an experiment,
I saw all files had their permission naturely right, some 644, some 755, exactly as described in wordpress document
Upvotes: 6
Views: 7503
Reputation: 1
So you could use the Windows FTP command "quote" which lets you send arbitrary commands to the FTP server.
Assuming your Linux FTP server supports SITE UMASK...
e.g. ftp> quote SITE UMASK 111
This would be equivalent to doing: chmod 666 * on the Linux command line but via FTP on Windows.
Upvotes: 0
Reputation: 392010
First, what username owns the files? What username do you connect as when you upload?
What is that user's default umask
setting?
Upvotes: 0
Reputation: 3
Assuming that you are using FTP to upload the files, better FTP clients (FileZilla) will allow you to set the permissions IF THE SERVER is setup to allow the FTP client to set it.
As far as "default settings", 644 is typically the default already for files. This again is set by the server. I would assume that there is an FTP client out there that will auto set it for every file, but I don't know for sure. If you go monkeying with permissions, remember that directories are 755, not 644, and it is possible that the server could let you remove your own access to the file.
Upvotes: 0
Reputation: 3251
I think this is not possible in most cases.
Could you give more information on how you upload? FTP, SFTP, SMB? :-)
For example for FTP you could configure the FTP server in order to give all new files the 644 umask (see this example for ProFTPd).
For SFTP, the client might be able to change the permissions after the upload, because it has SSH access, after all.
Upvotes: 4
Reputation: 200160
You can't. The permission is not written in the file itself, but rather in the filesystem. So it has to be done once the file has being uploaded.
Upvotes: 2