2 years ago

#75032

test-img

Ruben

This account is currently not available

Anyone know why case1 is not working properly as case2 ?

-case0:
#:/cloud/dahua# sudo -u sysUser echo hello
hello

-case1:
#: sudo -u sysUser flock -xn hello.lock -c "echo hello"
This account is currently not available.

-case2:
#:/cloud/dahua# sudo -u sysUser flock -xn hello.lock echo hello
hello

#:/cloud/dahua# cat /etc/passwd | grep sysUser
sysUser:x:1001:1001::/home/sysUser:/usr/sbin/nologin

Anyone know why case1 is not working properly as case2 ?

NAME top flock - manage locks from shell scripts DESCRIPTION top This utility manages flock(2) locks from within shell scripts or from the command line.

   The first and second of the above forms wrap the lock around the
   execution of a command, in a manner similar to su(1) or
   newgrp(1). They lock a specified file or directory, which is
   created (assuming appropriate permissions) if it does not already
   exist. By default, if the lock cannot be immediately acquired,
   flock waits until the lock is available.

   The third form uses an open file by its file descriptor number.
   See the examples below for how that can be used.

OPTIONS top -c, --command command Pass a single command, without arguments, to the shell with -c.

linux

shell

sudo

flock

0 Answers

Your Answer

Accepted video resources