Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 与sudo-1.6.9p17-6相比,sudo-1.8.6p3-15.x86_64(RHEL6.6)的行为是否有变化?_Linux_Bash_Sudo_Rhel6 - Fatal编程技术网

Linux 与sudo-1.6.9p17-6相比,sudo-1.8.6p3-15.x86_64(RHEL6.6)的行为是否有变化?

Linux 与sudo-1.6.9p17-6相比,sudo-1.8.6p3-15.x86_64(RHEL6.6)的行为是否有变化?,linux,bash,sudo,rhel6,Linux,Bash,Sudo,Rhel6,我们发现sudo-1.8.6p3-15.x86_64(RHEL6.6)与sudo-1.6.9p17-6(RHEL 5.8)相比存在行为变化 详细的级别说明如下所述 已经观察到,如果通过“sudo”调用脚本,并且如果将Ctrl+C(SIGINT)发送到前台进程,那么控件将返回到父进程而不是终端 复制步骤: 我们在RHEL5和RHEL6.6机器上执行了以下两个脚本。 a) 。parent.sh(parent) b) 。child.sh(child) 第一个脚本parent.sh: #!/bin/ba

我们发现sudo-1.8.6p3-15.x86_64(RHEL6.6)与sudo-1.6.9p17-6(RHEL 5.8)相比存在行为变化 详细的级别说明如下所述

已经观察到,如果通过“sudo”调用脚本,并且如果将Ctrl+C(SIGINT)发送到前台进程,那么控件将返回到父进程而不是终端

复制步骤:

我们在RHEL5和RHEL6.6机器上执行了以下两个脚本。 a) 。parent.sh(parent) b) 。child.sh(child)

第一个脚本parent.sh:

#!/bin/bash
sudo /root/child.sh
echo "Parent Process"
第二脚本child.sh:

#!/bin/bash
echo "hello"
sleep 90
预期成果:

RHEL5中的行为(与sudo 1.6.9一起) 每当我们将SIGINT发送给父节点时,子节点和父节点都会被杀死,控制返回到终端

    # sh parent.sh 
    hello
    ------> Ctrl+C pressed here
                                    ---> Both parent and child got killed.
parent.sh(14867) -> child.sh(14869) -> sleep(14870)
实际结果:

在RHEL 6.6(使用sudo-1.8.6p3)中,如果作为唯一子进程发送到efg.sh的SIGINT被终止,然后父进程继续执行,直到它顺利退出,或者再次由用户发送SIGINT

    # sh parent.sh 
    hello
    --------> Ctrl+C pressed here
    Parent Process  --> Parent still exist, but child killed
    -------> Ctrl+C pressed here
parent.sh(14867) -> sudo(14868) -> child.sh(14869) -> sleep(14870)

这里,在新的sudo包中生成了额外的sudo进程,但没有创建旧的sudo包。

在unix.stackexchange.com这可能是一个更好的问题在unix.stackexchange.com这可能是一个更好的问题