在udev事件上触发锁定/解锁XFCE会话


0

我正在尝试编写简单的脚本,该脚本将在通过USB连接手机时解锁XFCE会话(xubuntu),反之亦然->在手机断开连接时锁定。

到目前为止,我设法在udev中编写了新规则以在connect上启动脚本:

SUBSYSTEM=="usb", ACTION=="add", ATTRS{serial}=="(my serial here)", RUN+="/path/to/script/lock.sh"

要锁定屏幕,我可以使用xflock4,当您在xfce中按CTRL + ALT + DEL时也会触发。但是我不知道如何使用正在运行的xfce会话。现在,该脚本已由root触发。

脚本:

第一种方法

#!/bin/bash
xflock4

strace的

execve("./lock.sh", ["./lock.sh"], [/* 22 vars */]) = 0
brk(0)                                  = 0x23e2000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f190346f000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=96099, ...}) = 0
mmap(NULL, 96099, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f1903457000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libtinfo.so.5", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\303\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=167096, ...}) = 0
mmap(NULL, 2264288, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f1903026000
mprotect(0x7f190304b000, 2093056, PROT_NONE) = 0
mmap(0x7f190324a000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x24000) = 0x7f190324a000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\16\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=14664, ...}) = 0
mmap(NULL, 2109744, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f1902e22000
mprotect(0x7f1902e25000, 2093056, PROT_NONE) = 0
mmap(0x7f1903024000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f1903024000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\37\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1840928, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1903456000
mmap(NULL, 3949248, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f1902a5d000
mprotect(0x7f1902c18000, 2093056, PROT_NONE) = 0
mmap(0x7f1902e17000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ba000) = 0x7f1902e17000
mmap(0x7f1902e1d000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f1902e1d000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1903454000
arch_prctl(ARCH_SET_FS, 0x7f1903454740) = 0
mprotect(0x7f1902e17000, 16384, PROT_READ) = 0
mprotect(0x7f1903024000, 4096, PROT_READ) = 0
mprotect(0x7f190324a000, 16384, PROT_READ) = 0
mprotect(0x6ef000, 4096, PROT_READ)     = 0
mprotect(0x7f1903471000, 4096, PROT_READ) = 0
munmap(0x7f1903457000, 96099)           = 0
open("/dev/tty", O_RDWR|O_NONBLOCK)     = 3
close(3)                                = 0
brk(0)                                  = 0x23e2000
brk(0x23e3000)                          = 0x23e3000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=4164976, ...}) = 0
mmap(NULL, 4164976, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f1902664000
close(3)                                = 0
brk(0x23e4000)                          = 0x23e4000
brk(0x23e5000)                          = 0x23e5000
getuid()                                = 0
getgid()                                = 0
geteuid()                               = 0
getegid()                               = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
brk(0x23e6000)                          = 0x23e6000
open("/proc/meminfo", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f190346e000
read(3, "MemTotal:        7994668 kB\nMemF"..., 1024) = 1024
close(3)                                = 0
munmap(0x7f190346e000, 4096)            = 0
brk(0x23e7000)                          = 0x23e7000
rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f1902a93d40}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f1902a93d40}, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f1902a93d40}, 8) = 0
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f1902a93d40}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f1902a93d40}, {SIG_DFL, [], SA_RESTORER, 0x7f1902a93d40}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x7f1902a93d40}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x7f1902a93d40}, {SIG_DFL, [], SA_RESTORER, 0x7f1902a93d40}, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigaction(SIGQUIT, {SIG_IGN, [], SA_RESTORER, 0x7f1902a93d40}, {SIG_DFL, [], SA_RESTORER, 0x7f1902a93d40}, 8) = 0
uname({sys="Linux", node="kabaret", ...}) = 0
brk(0x23e8000)                          = 0x23e8000
brk(0x23e9000)                          = 0x23e9000
stat("/home/marverix/magic", {st_mode=S_IFDIR|0775, st_size=30, ...}) = 0
stat(".", {st_mode=S_IFDIR|0775, st_size=30, ...}) = 0
getpid()                                = 26451
open("/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=26258, ...}) = 0
mmap(NULL, 26258, PROT_READ, MAP_SHARED, 3, 0) = 0x7f1903468000
close(3)                                = 0
brk(0x23ea000)                          = 0x23ea000
getppid()                               = 26448
brk(0x23eb000)                          = 0x23eb000
brk(0x23ec000)                          = 0x23ec000
getpgrp()                               = 26448
rt_sigaction(SIGCHLD, {0x4464c0, [], SA_RESTORER|SA_RESTART, 0x7f1902a93d40}, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f1902a93d40}, 8) = 0
getrlimit(RLIMIT_NPROC, {rlim_cur=30433, rlim_max=30433}) = 0
brk(0x23ed000)                          = 0x23ed000
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
open("./lock.sh", O_RDONLY)             = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffde540f540) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR)                   = 0
read(3, "#!/bin/bash\n\nxflock4\n", 80) = 21
lseek(3, 0, SEEK_SET)                   = 0
getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=4*1024}) = 0
fcntl(255, F_GETFD)                     = -1 EBADF (Bad file descriptor)
dup2(3, 255)                            = 255
close(3)                                = 0
fcntl(255, F_SETFD, FD_CLOEXEC)         = 0
fcntl(255, F_GETFL)                     = 0x8000 (flags O_RDONLY|O_LARGEFILE)
fstat(255, {st_mode=S_IFREG|0775, st_size=21, ...}) = 0
lseek(255, 0, SEEK_CUR)                 = 0
brk(0x23ee000)                          = 0x23ee000
read(255, "#!/bin/bash\n\nxflock4\n", 21) = 21
stat(".", {st_mode=S_IFDIR|0775, st_size=30, ...}) = 0
stat("/usr/local/sbin/xflock4", 0x7ffde540f220) = -1 ENOENT (No such file or directory)
stat("/usr/local/bin/xflock4", 0x7ffde540f220) = -1 ENOENT (No such file or directory)
stat("/usr/sbin/xflock4", 0x7ffde540f220) = -1 ENOENT (No such file or directory)
stat("/usr/bin/xflock4", {st_mode=S_IFREG|0755, st_size=1560, ...}) = 0
stat("/usr/bin/xflock4", {st_mode=S_IFREG|0755, st_size=1560, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/usr/bin/xflock4", X_OK)        = 0
stat("/usr/bin/xflock4", {st_mode=S_IFREG|0755, st_size=1560, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/usr/bin/xflock4", R_OK)        = 0
stat("/usr/bin/xflock4", {st_mode=S_IFREG|0755, st_size=1560, ...}) = 0
stat("/usr/bin/xflock4", {st_mode=S_IFREG|0755, st_size=1560, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/usr/bin/xflock4", X_OK)        = 0
stat("/usr/bin/xflock4", {st_mode=S_IFREG|0755, st_size=1560, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/usr/bin/xflock4", R_OK)        = 0
rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f1903454a10) = 26452
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGINT, {0x4438a0, [], SA_RESTORER, 0x7f1902a93d40}, {SIG_DFL, [], SA_RESTORER, 0x7f1902a93d40}, 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 26452
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f1902a93d40}, {0x4438a0, [], SA_RESTORER, 0x7f1902a93d40}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=26452, si_status=0, si_utime=0, si_stime=0} ---
wait4(-1, 0x7ffde540ed58, WNOHANG, NULL) = -1 ECHILD (No child processes)
rt_sigreturn()                          = 0
read(255, "", 21)                       = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
exit_group(0)                           = ?
+++ exited with 0 +++

第二种方法

#!/bin/bash
su - marverix
xflock4
exit

strace的

execve("./lock.sh", ["./lock.sh"], [/* 22 vars */]) = 0
brk(0)                                  = 0x760000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6dfc7eb000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=96099, ...}) = 0
mmap(NULL, 96099, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f6dfc7d3000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libtinfo.so.5", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\303\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=167096, ...}) = 0
mmap(NULL, 2264288, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f6dfc3a2000
mprotect(0x7f6dfc3c7000, 2093056, PROT_NONE) = 0
mmap(0x7f6dfc5c6000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x24000) = 0x7f6dfc5c6000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\16\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=14664, ...}) = 0
mmap(NULL, 2109744, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f6dfc19e000
mprotect(0x7f6dfc1a1000, 2093056, PROT_NONE) = 0
mmap(0x7f6dfc3a0000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f6dfc3a0000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\37\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1840928, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6dfc7d2000
mmap(NULL, 3949248, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f6dfbdd9000
mprotect(0x7f6dfbf94000, 2093056, PROT_NONE) = 0
mmap(0x7f6dfc193000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ba000) = 0x7f6dfc193000
mmap(0x7f6dfc199000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f6dfc199000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6dfc7d0000
arch_prctl(ARCH_SET_FS, 0x7f6dfc7d0740) = 0
mprotect(0x7f6dfc193000, 16384, PROT_READ) = 0
mprotect(0x7f6dfc3a0000, 4096, PROT_READ) = 0
mprotect(0x7f6dfc5c6000, 16384, PROT_READ) = 0
mprotect(0x6ef000, 4096, PROT_READ)     = 0
mprotect(0x7f6dfc7ed000, 4096, PROT_READ) = 0
munmap(0x7f6dfc7d3000, 96099)           = 0
open("/dev/tty", O_RDWR|O_NONBLOCK)     = 3
close(3)                                = 0
brk(0)                                  = 0x760000
brk(0x761000)                           = 0x761000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=4164976, ...}) = 0
mmap(NULL, 4164976, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f6dfb9e0000
close(3)                                = 0
brk(0x762000)                           = 0x762000
brk(0x763000)                           = 0x763000
getuid()                                = 0
getgid()                                = 0
geteuid()                               = 0
getegid()                               = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
brk(0x764000)                           = 0x764000
open("/proc/meminfo", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6dfc7ea000
read(3, "MemTotal:        7994668 kB\nMemF"..., 1024) = 1024
close(3)                                = 0
munmap(0x7f6dfc7ea000, 4096)            = 0
brk(0x765000)                           = 0x765000
rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f6dfbe0fd40}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f6dfbe0fd40}, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f6dfbe0fd40}, 8) = 0
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f6dfbe0fd40}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f6dfbe0fd40}, {SIG_DFL, [], SA_RESTORER, 0x7f6dfbe0fd40}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x7f6dfbe0fd40}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x7f6dfbe0fd40}, {SIG_DFL, [], SA_RESTORER, 0x7f6dfbe0fd40}, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigaction(SIGQUIT, {SIG_IGN, [], SA_RESTORER, 0x7f6dfbe0fd40}, {SIG_DFL, [], SA_RESTORER, 0x7f6dfbe0fd40}, 8) = 0
uname({sys="Linux", node="kabaret", ...}) = 0
brk(0x766000)                           = 0x766000
brk(0x767000)                           = 0x767000
stat("/home/marverix/magic", {st_mode=S_IFDIR|0775, st_size=24, ...}) = 0
stat(".", {st_mode=S_IFDIR|0775, st_size=24, ...}) = 0
getpid()                                = 26389
open("/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=26258, ...}) = 0
mmap(NULL, 26258, PROT_READ, MAP_SHARED, 3, 0) = 0x7f6dfc7e4000
close(3)                                = 0
brk(0x768000)                           = 0x768000
getppid()                               = 26386
brk(0x769000)                           = 0x769000
brk(0x76a000)                           = 0x76a000
getpgrp()                               = 26386
rt_sigaction(SIGCHLD, {0x4464c0, [], SA_RESTORER|SA_RESTART, 0x7f6dfbe0fd40}, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f6dfbe0fd40}, 8) = 0
getrlimit(RLIMIT_NPROC, {rlim_cur=30433, rlim_max=30433}) = 0
brk(0x76b000)                           = 0x76b000
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
open("./lock.sh", O_RDONLY)             = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffc02ef3fb0) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR)                   = 0
read(3, "#!/bin/bash\n\nsu - marverix\nxfloc"..., 80) = 40
lseek(3, 0, SEEK_SET)                   = 0
getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=4*1024}) = 0
fcntl(255, F_GETFD)                     = -1 EBADF (Bad file descriptor)
dup2(3, 255)                            = 255
close(3)                                = 0
fcntl(255, F_SETFD, FD_CLOEXEC)         = 0
fcntl(255, F_GETFL)                     = 0x8000 (flags O_RDONLY|O_LARGEFILE)
fstat(255, {st_mode=S_IFREG|0775, st_size=40, ...}) = 0
lseek(255, 0, SEEK_CUR)                 = 0
brk(0x76c000)                           = 0x76c000
read(255, "#!/bin/bash\n\nsu - marverix\nxfloc"..., 40) = 40
stat(".", {st_mode=S_IFDIR|0775, st_size=24, ...}) = 0
stat("/usr/local/sbin/su", 0x7ffc02ef3c90) = -1 ENOENT (No such file or directory)
stat("/usr/local/bin/su", 0x7ffc02ef3c90) = -1 ENOENT (No such file or directory)
stat("/usr/sbin/su", 0x7ffc02ef3c90)    = -1 ENOENT (No such file or directory)
stat("/usr/bin/su", 0x7ffc02ef3c90)     = -1 ENOENT (No such file or directory)
stat("/sbin/su", 0x7ffc02ef3c90)        = -1 ENOENT (No such file or directory)
stat("/bin/su", {st_mode=S_IFREG|S_ISUID|0755, st_size=36936, ...}) = 0
stat("/bin/su", {st_mode=S_IFREG|S_ISUID|0755, st_size=36936, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/bin/su", X_OK)                 = 0
stat("/bin/su", {st_mode=S_IFREG|S_ISUID|0755, st_size=36936, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/bin/su", R_OK)                 = 0
stat("/bin/su", {st_mode=S_IFREG|S_ISUID|0755, st_size=36936, ...}) = 0
stat("/bin/su", {st_mode=S_IFREG|S_ISUID|0755, st_size=36936, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/bin/su", X_OK)                 = 0
stat("/bin/su", {st_mode=S_IFREG|S_ISUID|0755, st_size=36936, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/bin/su", R_OK)                 = 0
rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0
lseek(255, -13, SEEK_CUR)               = 27
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f6dfc7d0a10) = 26390
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGINT, {0x4438a0, [], SA_RESTORER, 0x7f6dfbe0fd40}, {SIG_DFL, [], SA_RESTORER, 0x7f6dfbe0fd40}, 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 26390
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f6dfbe0fd40}, {0x4438a0, [], SA_RESTORER, 0x7f6dfbe0fd40}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=26390, si_status=0, si_utime=0, si_stime=0} ---
wait4(-1, 0x7ffc02ef37d8, WNOHANG, NULL) = -1 ECHILD (No child processes)
rt_sigreturn()                          = 0
read(255, "xflock4\nexit\n", 40)        = 13
stat(".", {st_mode=S_IFDIR|0775, st_size=24, ...}) = 0
stat("/usr/local/sbin/xflock4", 0x7ffc02ef3c90) = -1 ENOENT (No such file or directory)
stat("/usr/local/bin/xflock4", 0x7ffc02ef3c90) = -1 ENOENT (No such file or directory)
stat("/usr/sbin/xflock4", 0x7ffc02ef3c90) = -1 ENOENT (No such file or directory)
stat("/usr/bin/xflock4", {st_mode=S_IFREG|0755, st_size=1560, ...}) = 0
stat("/usr/bin/xflock4", {st_mode=S_IFREG|0755, st_size=1560, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/usr/bin/xflock4", X_OK)        = 0
stat("/usr/bin/xflock4", {st_mode=S_IFREG|0755, st_size=1560, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/usr/bin/xflock4", R_OK)        = 0
stat("/usr/bin/xflock4", {st_mode=S_IFREG|0755, st_size=1560, ...}) = 0
stat("/usr/bin/xflock4", {st_mode=S_IFREG|0755, st_size=1560, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/usr/bin/xflock4", X_OK)        = 0
stat("/usr/bin/xflock4", {st_mode=S_IFREG|0755, st_size=1560, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/usr/bin/xflock4", R_OK)        = 0
brk(0x76d000)                           = 0x76d000
rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0
lseek(255, -5, SEEK_CUR)                = 35
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f6dfc7d0a10) = 26417
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGINT, {0x4438a0, [], SA_RESTORER, 0x7f6dfbe0fd40}, {SIG_DFL, [], SA_RESTORER, 0x7f6dfbe0fd40}, 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 26417
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f6dfbe0fd40}, {0x4438a0, [], SA_RESTORER, 0x7f6dfbe0fd40}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=26417, si_status=0, si_utime=0, si_stime=0} ---
wait4(-1, 0x7ffc02ef37d8, WNOHANG, NULL) = -1 ECHILD (No child processes)
rt_sigreturn()                          = 0
read(255, "exit\n", 40)                 = 5
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
exit_group(0)                           = ?
+++ exited with 0 +++

有任何想法吗?

同样大的帮助将是登录的提示;)


您的这个脚本到底是什么?理想地使用RUN + =的/ usr /斌/ xflock4在于udev规则应足以
linuxdev2013

我也这么认为-但这行不通。我尝试使用sudo切换到我的帐户,然后运行xflock4。但仍然-没有成功。
marverix

介意从两种方式共享strace日志?包括您描述的脚本?
linuxdev2013'2013-4-28

更新:尝试添加导出DISPLAY =:0。依然没有。
marverix

须藤需要NOT苏我觉得作为须藤xflock4我在这里工作了关于Xfce 4.12
linuxdev2013
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.