Shell脚本将访问控制列表分配给文件

时间:2016-09-19 00:58:40

标签: shell acl

如何使用shell脚本创建没有ACL的文件...我只想要chmod 644 {filename}?此脚本采用pgn文件并分离各个游戏分数(pgn国际象棋符号),并根据增加的提供值将游戏写入单个文件.6444.pgn 6445.pgn ... 6446.pgn等此脚本已正常工作就在我从Linux Mint 17升级到LM 18之前。但不再是。

#!/bin/bash
# INSTRUCTIONS:
# EDit IGS-YYYY-MM-DD clean up English.
# type: prepare_bulk IGS-YYYY-MM-DD {last game} 3rd parameter = annotator's initials 
# (Fixes errors in Igor's game submissions and writes the individual gamescores from larger pgn file )
# (And convert xx00 to XXXX.pgn)

AUTHOR='{(Randy MacKenzie)}' #$3   

OBJECT=IGS-$1.pgn; ULFILE="/home/rmack/Downloads/$OBJECT"; TARGET=/mnt/www/cccr/games/$OBJECT;

offset=$2; dos2unix -q $ULFILE; awk -v RS='^$' -v ORS= '{gsub(/{\n/, "{")} 1' $ULFILE >junk.txt;

(A lot of awk and sed goes here)

cp junk.txt $TARGET; 

chmod 644 $TARGET;  

cd /home/rmack/www/cccr/games/; csplit -s $TARGET /Event\ / {*}; rm /home/rmack/www/cccr/games/xx00;

for file in xx[0-9]*; do
num0=${file##*x}; num=${num0#0};  (( newnum = num + offset ))
mv $file ${newnum}.pgn;  branch=${newnum}.pgn; 
echo $newnum; chmod 777 $branch; cat "$AUTHOR" >> "$branch"; 
echo "$AUTHOR" >> "$branch"; 

chmod 644 $branch;

done





chmod: changing permissions of '.pgn': Permission denied
rmack@porter ~ $ ls -lah /mnt/www/cccr/games/IGS-2016-09-14.pgn 
-rwxrwxrwx+ 1 rmack rmack 3.0K Sep 18 15:40 /mnt/www/cccr/games/IGS-    2016-09-14.pgn
rmack@porter ~ $ 

via man page 'ls'

"If the file or directory has extended security information, the  permissions field printed by the -l option is followed by a '+' character."

This generally means the file is encumbered with access restrictions outside of the traditional Unix permissions - likely Access Control List (ACL).

0 个答案:

没有答案