0

I am trying to write a bash script to upload some files using lftp and need to set the umask to 002. I cant seem to figure out how this is done within the context of lftp.

lftp -c "open sftp://$STAGE_FTP_HOST
            user $STAGE_FTP_USER $STAGE_FTP_PASS
            cd web/content
            mirror -P --only-newer --reverse --delete --verbose --exclude wp-content/uploads --exclude wp-content/cache --exclude .git* "

I have tried setting umask in /etc/pam.d/sshd, ~/.bashrc and /etc/ssh/sshd_config nothing has any effect.

To clarify I need to add group permission to files and folders on the remote machine. So instead of 755 i need 775 instead of 644 i need 664.

It seems like there is something specific to lftp that needs to be set that I am just completely missing.

Cluke009
  • 63
  • 1
  • 5
  • `sftp` has a `chmod` interactive command, that I believe I have scripted in the past to change permissions on files that have been delivered. I don't have access to look at that code anymore, so won't be able to add much more than that. Also, you may want to clarify your question that you're trying to add `umask` cmds on the remote machine config files, right? Good luck. – shellter Jan 30 '15 at 19:57
  • Updated the question. I have considered programmatically chmod'ing everything it just seemed like this is something I should be able to do out of the box. – Cluke009 Jan 30 '15 at 21:18
  • instead of 755 i need 775 , yes, I had the same "opportunity". I didn't know about/have access to lftp, but I definitely used the chmod with sftp in a script. Hm.. installed lftp for its man page. Rather lengthy!. I see options `--no-umask, --no-perms` under `--mirror` but as with any large program, contradictory information abounds. I also see a `chmod ` interactive command listed there. Searching for permis and umask may get you something. Good luck. – shellter Jan 30 '15 at 23:38

1 Answers1

0

lftp command chmod -R g+w . should do what you need (change permissions on the remote server).

For new uploads mirror --no-umask may also help, if local permissions are correct.

lav
  • 1,177
  • 8
  • 16