Ok I seem to have managed to work out the correct command to rsync a file on my local machine with a file on my remote machine/server using:
rsync -avc ../myfile.html/
abc@abce.co.uk:~ remotefolder/target/
However what happens with this command, it changes the read and write privileges of the file automatically. So when I go to visit the web page showing the target file (myflile.html), I get the error:
Forbidden
You don't have permission to access / on this server.
Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.5 with Suhosin-Patch mod_ssl/2.2.11 OpenSSL/0.9.8g Server at www.somefile.co.uk Port 80
So the rsync command I'm using is changing the read and write configurations of the file!!!
The question is therefore, firstly, using sftp or rysnc, how do I change the file permissions to allow me to view myfile.html (as it is currently not visible), and secondly, if I am doing an rsync command in the future, what is the correct sequence of letters to use (remember I've currently used: -avc)
Would really appreciate any help. Unfortunately I'm restricted to working on a website using rsync,ssh and sftp, so no Filezilla and the like is allowed!!!
Cheers
Volterony
---------- Post updated 07-27-10 at 10:14 AM ---------- Previous update was 07-26-10 at 02:59 PM ----------
Ok have figured out what the problem is!!
I have been executing this command:
rsync -a -e ssh /Users/myname/myfolder/sourcefolder/
sd@somedomain.co.uk:/sd/lfr/htdocs/
The problem with this is that when you use "-a" in the command, you are telling rsync to 'preserve file permissions'. So what this does is that it overwrites your remote file permissions with your local file permissions!!!! BECAUSE IT IS PRESERVING YOUR LOCAL PERMISSIONS!
So instead, if you just want to rysnc a file without changing the file permissions on the remote machine, you use rsync -r!!! In this case the remote machine file permissions will remain intact.
When you change the file permission on the remote machine using -a, you end up getting a 403 forbidden error, so you then need to manually change these (I used a chmod command over sftp).
Obviously you need to make that the correct file permissions is set.
This is more of a note to self, but hopefully it will help someone!!
Volterony