shell - What kind of permission is required to access and rename a directory? -


among x, w, r, permission required access , rename directory. (i'll use cd , mv respectively)

just note, mv need rights modify (w)the current directory too, because writes new content (the new name) it..

demo:

testdir="./$0.$$" pwd="$(pwd)" err()(echo "$@">&2; return 1)  echo "creating $testdir" mkdir "$testdir" || err "can't mkdir $testdir" || exit 1 ls -la "$testdir"  trap 'cd "$pwd"; chmod 777 "$testdir"; rm -rf "$testdir"; exit' 0 1 2 15  #ensure 'w' demo chmod 755 "$testdir"  echo "cd $testdir" cd "$testdir" || err "can't cd $testdir" || exit 1  echo "mkdir a" mkdir || err "can't mkdir a" || exit 1 ls -la  echo renaming b mv b || err "can't rename b" || exit 1 ls -la  echo "rewoke 'w' permission $testdir (now .)" chmod 555 . || err "can't chmod 555 ." || exit 1 ls -la  echo trying rename b c mv b c || err "can't rename b c - failed" ls -la 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -