2

I want to run rsync to copy files from local mac folders to a corporate network drive. To access the network drive I have to mount it using different credentials compared to my local user account.

How can I tell my bash script (that runs a few different rsyncs) to run as the other user (my corporate network user) to avoid getting forbidden (13) errors

failed: Permission denied (13)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-45/rsync/main.c(992)

EDIT:

Ok, so I created and mounted a share at ~/smb/pfimp/ - I can read the files perfectly fine, and it will create folders on the file server, but it can't copy the actual files over.

Any other suggestions? thanks

MAC:bin mylocaluser$ rsync -azP --exclude=.DS_Store ~/Documents/Work/Master/Scripts/demo/ ~/smb/pfimp/Scripts/demo
building file list ... 
38 files to consider
./
external/
external/workflow.py
        1225 100%    0.00kB/s    0:00:00 (xfer#1, to-check=35/38)
external/override/
external/override/before.py
        3229 100%    3.08MB/s    0:00:00 (xfer#2, to-check=33/38)
rsync: mkstemp "/Users/mylocaluser/smb/pfimp/Scripts/demo/external/.workflow.py.sEm5kg" failed: Permission denied (13)
rsync: mkstemp "/Users/mylocaluser/smb/pfimp/Scripts/demo/external/override/.before.py.iKs9MS" failed: Permission denied (13)

sent 2811 bytes  received 82 bytes  385.73 bytes/sec
total size is 31779  speedup is 10.98
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-45/rsync/main.c(992) [sender=2.6.9]
1
  • ps: changing the rsync command from your first post without mounting the share would be a solution, but if you are working on a Mac, then, at almost any time it would be better to mount the share and then copy files "locally" because that uses the apple provided software, the software that fit into your Apple pc, and that piece of software that apple improve instead of the standard Gnu rsync (it would mostly not be the standard Gnu rsync but apple does not improve those applets, but there own tools to mount and so on) Aug 10, 2015 at 17:32

1 Answer 1

0

You can use mount_afp to actually mount the share onto your computer, and afterwards use rsync (or another command) to copy your files to the share.

Usage:

mount_afp afp://yourserver/yourshare/folder mountpoint

if you use the smb protocol, you can use mount_smbfs

see the manpage of mount_afp and this one for mount_smbfs

EDIT rsync with the option -a has the problem that it tries to set permissions, but it can't because of the samba share. using the -r option instead of -a change that behavior.

3
  • thanks, although see my edit to the question - it still doesn't work. Any further suggestions?
    – JPMox
    Aug 10, 2015 at 14:16
  • do you see the "Permission Denied?" I researched and found out that " Basically its because it trys to do it in archive mode, and I don’t have permission to change the permissions. So, if you remove the -a you should not see this error" Aug 10, 2015 at 16:15
  • brilliant, thanks so much! by using rsync -rzP (a to r) it didn't try to set permissions on the files on the server
    – JPMox
    Aug 10, 2015 at 16:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .