docker

【Docker】容器中目录、文件权限初始化

2023-09-19  本文已影响0人  Bogon

$ cat init.sh

#!/bin/sh 
set -x

SRC=/opt/from 
DST=/opt/to

for d in $SRC/*/; do
  BASE=`basename "$d" `
  if [ !  -d   "$DST/$BASE"  ]; then 
      cp -r  $d  "$DST/$BASE" 
   fi
 done
for  dir  in $SRC/*/;  do
  FNAME=$(basename $dir)

  find $DST/$FNAME  -type  d  -exec  chown 2023:2023 {}\;
  find $DST/$FNAME  -type  d  -exec chmod 700 {} \;

  find $DST/$FNAME  -type f -exec chown 2023:2023 {}\;
  find $DST/$FNAME  -type f -exec chmod 400 {} \;
  done
上一篇 下一篇

猜你喜欢

热点阅读