Sponsored Content
Full Discussion: rsync
Top Forums Shell Programming and Scripting rsync Post 302440153 by volterony on Tuesday 27th of July 2010 05:14:17 AM
Old 07-27-2010
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
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

rsync

I want to do rsync only for the difference in the last 30 days. How do I specify the "30 days" on the command line below? >rsync -avz prj# /rsource /destination Thanks for help (6 Replies)
Discussion started by: wz253
6 Replies

2. UNIX for Advanced & Expert Users

Rsync

I have to update my files to 2-4 servers and I tar all the files and ftp to every server. I have heard about Rsync, but are there any other ways that are the same as Rsync?> (1 Reply)
Discussion started by: darknite87
1 Replies

3. UNIX for Dummies Questions & Answers

rsync vs cp

Hi guys, I will be copying data from one FS to another. (only once) These are local Filesystems... Which tool would be more efficient to use in this case? There is a huge amount of data that needs to be copied... (1.5TB) John (1 Reply)
Discussion started by: jsy
1 Replies

4. Solaris

please help in rsync

Dear all, I m trying to rsync a file remotely but it is throwing following error. #/opt/sfw/bin/rsync -v -a -e ssh user@xx.xx.xx.xx:/export/home/naresh/utils.sh bash: rsync: command not found rsync: connection unexpectedly closed (0 bytes read so far) rsync error: error in... (10 Replies)
Discussion started by: naree
10 Replies

5. UNIX for Dummies Questions & Answers

rsync

i last night i copied a 400GB folder using rsync and ssh i did: rsync -r /mnt/500_GB ssh miguel@192.168.1.3:/mnt/1500_GB and it copied the folder fine all 400GB. The question is: If i put more files to that initial 400GB folder, which command can i run on my server for it to update the... (4 Replies)
Discussion started by: supermiguel
4 Replies

6. Shell Programming and Scripting

rsync

Am I correct in assuming that the following command: rsync -a /a /b does not make any changes on /a if there are files on /b that are newer (2 Replies)
Discussion started by: jgt
2 Replies

7. SuSE

rsync

I'm trying to use rsync to sync some data from my windows laptop to my linux openSUSE home sytem using cwRsync. The process has always worked until I got a new laptop and more or less at the same time decided to rebuild my linux box. on linux rsync --version rsync version 3.0.7 protocol... (2 Replies)
Discussion started by: giessenw
2 Replies

8. UNIX for Dummies Questions & Answers

rsync

Hi all, I'm new to the rsync world in hpux. Currently I have rsync going through the main public lan, but dude to traffic loads, I have been told that i need to use a dedicated rsync lan. I currently have 4 spare nics and the plan was to use one of these for the rsync, but I can't figure out... (2 Replies)
Discussion started by: linuxwanabe
2 Replies

9. Shell Programming and Scripting

Rsync Error: rsync: link_stat failed: No such file or directory (2)

I wish to copy all the files & folder under /web/Transfer_Files/data/ on mymac1 (Linux) to remote server mybank.intra.com (Solaris 10) /tmp/ location I am using Ansible tool synchronize module which triggers the unix rsync command as below:rsync --delay-updates -F --compress --archive --rsh=ssh... (2 Replies)
Discussion started by: mohtashims
2 Replies
SFTP(1) 						    BSD General Commands Manual 						   SFTP(1)

NAME
sftp -- Secure file transfer program SYNOPSIS
sftp [-vC1] [-b batchfile] [-o ssh_option] [-s subsystem | sftp_server] [-B buffer_size] [-F ssh_config] [-P sftp_server path] [-R num_requests] [-S program] host sftp [[user@]host[:file [file]]] sftp [[user@]host[:dir[/]]] DESCRIPTION
sftp is an interactive file transfer program, similar to ftp(1), which performs all operations over an encrypted ssh(1) transport. It may also use many features of ssh, such as public key authentication and compression. sftp connects and logs into the specified host, then enters an interactive command mode. The second usage format will retrieve files automatically if a non-interactive authentication method is used; otherwise it will do so after successful interactive authentication. The last usage format allows the sftp client to start in a remote directory. The options are as follows: -b batchfile Batch mode reads a series of commands from an input batchfile instead of stdin. Since it lacks user interaction it should be used in conjunction with non-interactive authentication. sftp will abort if any of the following commands fail: get, put, rename, ln, rm, mkdir, chdir, lchdir and lmkdir. -o ssh_option Can be used to pass options to ssh in the format used in ssh_config(5). This is useful for specifying options for which there is no separate sftp command-line flag. For example, to specify an alternate port use: sftp -oPort=24. -s subsystem | sftp_server Specifies the SSH2 subsystem or the path for an sftp server on the remote host. A path is useful for using sftp over protocol ver- sion 1, or when the remote sshd does not have an sftp subsystem configured. -v Raise logging level. This option is also passed to ssh. -B buffer_size Specify the size of the buffer that sftp uses when transferring files. Larger buffers require fewer round trips at the cost of higher memory consumption. The default is 32768 bytes. -C Enables compression (via ssh's -C flag). -F ssh_config Specifies an alternative per-user configuration file for ssh. This option is directly passed to ssh(1). -P sftp_server path Connect directly to a local sftp-server (rather than via ssh) This option may be useful in debugging the client and server. -R num_requests Specify how many requests may be outstanding at any one time. Increasing this may slightly improve file transfer speed but will increase memory usage. The default is 16 outstanding requests. -S program Name of the program to use for the encrypted connection. The program must understand ssh(1) options. -1 Specify the use of protocol version 1. INTERACTIVE COMMANDS
Once in interactive mode, sftp understands a set of commands similar to those of ftp(1). Commands are case insensitive and pathnames may be enclosed in quotes if they contain spaces. bye Quit sftp. cd path Change remote directory to path. lcd path Change local directory to path. chgrp grp path Change group of file path to grp. grp must be a numeric GID. chmod mode path Change permissions of file path to mode. chown own path Change owner of file path to own. own must be a numeric UID. exit Quit sftp. get [flags] remote-path [local-path] Retrieve the remote-path and store it on the local machine. If the local path name is not specified, it is given the same name it has on the remote machine. If the -P flag is specified, then the file's full permission and access time are copied too. help Display help text. lls [ls-options [path]] Display local directory listing of either path or current directory if path is not specified. lmkdir path Create local directory specified by path. ln oldpath newpath Create a symbolic link from oldpath to newpath. lpwd Print local working directory. ls [flags] [path] Display remote directory listing of either path or current directory if path is not specified. If the -l flag is specified, then dis- play additional details including permissions and ownership information. lumask umask Set local umask to umask. mkdir path Create remote directory specified by path. put [flags] local-path [local-path] Upload local-path and store it on the remote machine. If the remote path name is not specified, it is given the same name it has on the local machine. If the -P flag is specified, then the file's full permission and access time are copied too. pwd Display remote working directory. quit Quit sftp. rename oldpath newpath Rename remote file from oldpath to newpath. rmdir path Remove remote directory specified by path. rm path Delete remote file specified by path. symlink oldpath newpath Create a symbolic link from oldpath to newpath. ! command Execute command in local shell. ! Escape to local shell. ? Synonym for help. AUTHORS
Damien Miller <djm@mindrot.org> SEE ALSO
scp(1), ssh(1), ssh-add(1), ssh-keygen(1), ssh_config(5), sftp-server(8), sshd(8) T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh-filexfer-00.txt, January 2001, work in progress material. BSD
February 4, 2001 BSD
All times are GMT -4. The time now is 08:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy