lftp icon indicating copy to clipboard operation
lftp copied to clipboard

default permissions for folders and files

Open zdenekgebauer opened this issue 10 years ago • 6 comments

I missing configuration of permissions for newly uploaded files and folders separately, because there is a problem to transfer permissions from windows to linux server . For example something like this:

set ftp:default-file-perm=0644 set ftp:default-folder-perm=0755 open ftp://user:password@site mirror -R quit

zdenekgebauer avatar Jan 17 '15 18:01 zdenekgebauer

I use this hack to correct the permissions of uploaded files:

#!/bin/bash
FTPURL="ftp://user@host"
LCD="$(readlink -f "$(dirname "$0")")/public"
if [ "$(expr substr "$(uname -s)" 1 5)" == "MINGW" ]; then
	LCD="/cygdrive$LCD"
fi
RCD="/"
lftp -c "set ftp:list-options -a;
set cmd:fail-exit yes;
open '$FTPURL';
lcd '$LCD';
cd '$RCD';
mirror --reverse --verbose --only-newer --ignore-time --no-perms" | python -c "import fileinput
import sys
import re
print(\"open '$FTPURL';\")
for l in fileinput.input():
	print(l, file=sys.stderr, end='')
	f = re.search(\"Transferring file \`(.+)'\", l)
	d = re.search(\"Making directory \`(.+)'\", l)
	if f:
		print(\"Changing permissions of \`\" + f.group(1) + \"' to 644\", file=sys.stderr)
		print(\"chmod 644 '\" + f.group(1).replace(\"'\", \"\\\\'\") + \"';\")
	elif d:
		print(\"Changing permissions of \`\" + d.group(1) + \"' to 755\", file=sys.stderr)
		print(\"chmod 755 '\" + d.group(1).replace(\"'\", \"\\\\'\") + \"';\")" | lftp

jtojnar avatar Dec 05 '16 17:12 jtojnar

Have you tried --no-perms option?

пн, 5 дек. 2016, 20:06 Jan Tojnar [email protected]:

I use this hack to correct the permissions of uploaded files:

#!/bin/bash FTPURL="ftp://user@host" LCD="$(readlink -f "$(dirname "$0")")/public"if [ "$(expr substr "$(uname -s)" 1 5)" == "MINGW" ]; then LCD="/cygdrive$LCD"fi RCD="/" lftp -c "set ftp:list-options -a;set cmd:fail-exit yes;open '$FTPURL';lcd '$LCD';cd '$RCD';mirror --reverse --verbose --only-newer --ignore-time" | python -c "import fileinputimport sysimport reprint("open '$FTPURL';")for l in fileinput.input(): print(l, file=sys.stderr, end='') f = re.search("Transferring file `(.+)'", l) d = re.search("Making directory `(.+)\'", l) if f: print("Changing permissions of `" + f.group(1) + "' to 644", file=sys.stderr) print("chmod 644 '" + f.group(1) + "';") elif d: print("Changing permissions of `" + d.group(1) + "' to 755", file=sys.stderr) print("chmod 755 '" + d.group(1) + "';")" | lftp

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lavv17/lftp/issues/119#issuecomment-264912750, or mute the thread https://github.com/notifications/unsubscribe-auth/AA67XE9jhPfEOfiNULJmTt3YrZG37JI6ks5rFESzgaJpZM4DTvis .

lavv17 avatar Dec 07 '16 03:12 lavv17

Yes. That seems to set 770 instead of 750. I need the others’ read permission to be enabled, though.

On 7 December 2016 at 04:20, Alexander V. Lukyanov <[email protected]

wrote:

Have you tried --no-perms option?

пн, 5 дек. 2016, 20:06 Jan Tojnar [email protected]:

I use this hack to correct the permissions of uploaded files:

#!/bin/bash FTPURL="ftp://user@host" LCD="$(readlink -f "$(dirname "$0")")/public"if [ "$(expr substr "$(uname -s)" 1 5)" == "MINGW" ]; then LCD="/cygdrive$LCD"fi RCD="/" lftp -c "set ftp:list-options -a;set cmd:fail-exit yes;open '$FTPURL';lcd '$LCD';cd '$RCD';mirror --reverse --verbose --only-newer --ignore-time" | python -c "import fileinputimport sysimport reprint("open '$FTPURL';")for l in fileinput.input(): print(l, file=sys.stderr, end='') f = re.search("Transferring file `(.+)'", l) d = re.search("Making directory `(.+)\'", l) if f: print("Changing permissions of `" + f.group(1) + "' to 644", file=sys.stderr) print("chmod 644 '" + f.group(1) + "';") elif d: print("Changing permissions of `" + d.group(1) + "' to 755", file=sys.stderr) print("chmod 755 '" + d.group(1) + "';")" | lftp

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lavv17/lftp/issues/119#issuecomment-264912750, or mute the thread <https://github.com/notifications/unsubscribe-auth/ AA67XE9jhPfEOfiNULJmTt3YrZG37JI6ks5rFESzgaJpZM4DTvis> .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lavv17/lftp/issues/119#issuecomment-265344724, or mute the thread https://github.com/notifications/unsubscribe-auth/AArCY9jvJ3qopnpc3SuRMpDIl6xFCvEoks5rFiX6gaJpZM4DTvis .

jtojnar avatar Dec 07 '16 03:12 jtojnar

What happens if you do "site umask 022" before upload?

ср, 7 дек. 2016, 6:58 Jan Tojnar [email protected]:

Yes. That seems to set 770 instead of 750. I need the others’ read permission to be enabled, though.

On 7 December 2016 at 04:20, Alexander V. Lukyanov < [email protected]

wrote:

Have you tried --no-perms option?

пн, 5 дек. 2016, 20:06 Jan Tojnar [email protected]:

I use this hack to correct the permissions of uploaded files:

#!/bin/bash FTPURL="ftp://user@host" LCD="$(readlink -f "$(dirname "$0")")/public"if [ "$(expr substr "$(uname -s)" 1 5)" == "MINGW" ]; then LCD="/cygdrive$LCD"fi RCD="/" lftp -c "set ftp:list-options -a;set cmd:fail-exit yes;open '$FTPURL';lcd '$LCD';cd '$RCD';mirror --reverse --verbose --only-newer --ignore-time" | python -c "import fileinputimport sysimport reprint("open '$FTPURL';")for l in fileinput.input(): print(l, file=sys.stderr, end='') f = re.search("Transferring file `(.+)'", l) d = re.search("Making directory `(.+)\'", l) if f: print("Changing permissions of `" + f.group(1) + "' to 644", file=sys.stderr) print("chmod 644 '" + f.group(1) + "';") elif d: print("Changing permissions of `" + d.group(1) + "' to 755", file=sys.stderr) print("chmod 755 '" + d.group(1) + "';")" | lftp

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lavv17/lftp/issues/119#issuecomment-264912750, or mute the thread <https://github.com/notifications/unsubscribe-auth/ AA67XE9jhPfEOfiNULJmTt3YrZG37JI6ks5rFESzgaJpZM4DTvis> .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lavv17/lftp/issues/119#issuecomment-265344724, or mute the thread < https://github.com/notifications/unsubscribe-auth/AArCY9jvJ3qopnpc3SuRMpDIl6xFCvEoks5rFiX6gaJpZM4DTvis

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/lavv17/lftp/issues/119#issuecomment-265349360, or mute the thread https://github.com/notifications/unsubscribe-auth/AA67XCi3IYCC1Z6K-YlsjMmPRJOrmC9Tks5rFi72gaJpZM4DTvis .

lavv17 avatar Dec 07 '16 05:12 lavv17

set ftp:default-file-perm=0644 set ftp:default-folder-perm=0755

Are these options documented anywhere? They aren't here: https://lftp.yar.ru/lftp-man.html

rpgdev avatar Aug 20 '19 10:08 rpgdev

There are no such settings in lftp.

lavv17 avatar Aug 23 '19 21:08 lavv17