美文网首页docker
【Docker】容器中目录、文件权限初始化

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

作者: Bogon | 来源:发表于2023-09-19 23:27 被阅读0次

$ 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

相关文章

网友评论

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

    本文链接:https://www.haomeiwen.com/subject/ffcjsdtx.html