📄 fail-2eperm
字号:
#!/bin/sh# Like fail-eperm, but the failure must be for a file encountered# while trying to remove the containing directory with the sticky bit set.if test "$VERBOSE" = yes; then set -x rm --versionfi. $srcdir/../lang-defaultPRIV_CHECK_ARG=require-root . $srcdir/../priv-checkpwd=`pwd`t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0trap '(exit $?); exit $?' 1 2 13 15framework_failure=0mkdir -p $tmp || framework_failure=1cd $tmp || framework_failure=1# Find a username with UID != 0, and a valid shell.non_root_username=names=`grep -v '[^:]*:[^:]*:0:' /etc/passwd| sed 's/:.*//'`for name in $names; do su -c ':' $name && { non_root_username=$name; break; }donetest "x$non_root_username" = x && framework_failure=1# The containing directory must be owned by the user who eventually runs rm.chown $non_root_username .mkdir a || framework_failure=1chmod 1777 a || framework_failure=1touch a/b || framework_failure=1if test $framework_failure = 1; then echo "$0: failure in testing framework" 1>&2 (exit 1); exit 1fifail=0su -c 'rm -rf a' $non_root_username 2> out && fail=1cat <<\EOF > exprm: cannot remove `a/b': Operation not permittedEOFcmp out exp || fail=1test $fail = 1 && diff out exp 2> /dev/null(exit $fail); exit $fail
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -