Linux無法使用
無法使用 capsh
的 ==
參數重新執行它?
我正在試驗
capsh
(libcap2-bin
1:2.32-1),但發現我無法使用==
re-exec 的參數capsh
。特別是,當我使用
capsh
‘參數時==
,它抱怨它不能外殼?execve(2)``/bin/bash
有沒有人嘗試過類似的問題?
ls -la /bin/bash -rwxr-xr-x 1 root root 1183448 Jun 18 2020 /bin/bash capsh --help ... == re-exec(capsh) with args as for -- ... capsh == --print execve /bin/bash failed! capsh --print Current: = Bounding set =cap_chown,cap_dac_override,cap_dac_read_search,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_linux_immutable,cap_net_bind_service,cap_net_broadcast,cap_net_admin,cap_net_raw,cap_ipc_lock,cap_ipc_owner,cap_sys_module,cap_sys_rawio,cap_sys_chroot,cap_sys_ptrace,cap_sys_pacct,cap_sys_admin,cap_sys_boot,cap_sys_nice,cap_sys_resource,cap_sys_time,cap_sys_tty_config,cap_mknod,cap_lease,cap_audit_write,cap_audit_control,cap_setfcap,cap_mac_override,cap_mac_admin,cap_syslog,cap_wake_alarm,cap_block_suspend,cap_audit_read Ambient set = Securebits: 00/0x0/1'b0 secure-noroot: no (unlocked) secure-no-suid-fixup: no (unlocked) secure-keep-caps: no (unlocked) secure-no-ambient-raise: no (unlocked) uid=1000(parallels) euid=1000(parallels) gid=1000(parallels) groups=4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),120(lpadmin),131(lxd),132(sambashare),1000(parallels) Guessed mode: UNCERTAIN (0)
問題是它試圖重新執行自身
capsh
(或您啟動它的任何命令名稱和路徑)。這是來自
strace capsh == --print
:execve("capsh", ["capsh", "--print"], [/* 20 vars */]) = -1 ENOENT (No such file or directory) write(2, "execve /bin/bash failed!\n", 25execve /bin/bash failed! ) = 25
因此
execve /bin/bash
,失敗的並不是真正的“”,而是execve capsh
. 該execve()
函式不會在$PATH
.使用
capsh
其完整路徑將使其工作。$ command -v capsh /sbin/capsh $ /sbin/capsh == --print Current: = [... etc. ...]
另請參閱
execve(2)
系統手冊 (man 2 execve
)。