Created attachment 432973 [details] kickstart to help reproduce the problem Description of problem: `tgt-admin --dump` works fine (outputs the current tgtd configuration), but `sudo tgt-admin --dump` does not. Version-Release number of selected component (if applicable): scsi-target-utils-0.0-6.20091205snap.el5_4.1.x86_64 sudo-1.7.2p1-5.el5.x86_64 sudo-1.7.2p1-7.el5_5.x86_64 How reproducible: Always Steps to Reproduce: 1. Install RHEL5 with scsi-target-utils 2. configure a LUN with tgt-adm 3. use tgt-admin to dump configuration 4. use tgt-admin to dump configuration, with sudo Actual results: The first dump contains the configuration, the second (with sudo) does not. Expected results: Both outputs should be identical. Additional info: I am including a kickstart file to help reproduce the bug. The kickstart installs all the necessary packages and creates a shell script in /root to demonstrate the problem. The root password of the installed system is "testiscsi". Note that I am not sure the problem comes from scsi-target-utils and not from sudo.
Sample output: [root@localhost ~]# tgt-admin --dump default-driver iscsi <target iqn.2010-07.NET.YOURDOMAIN:storage.vm1.smh> backing-store /dev/tgtdtest/lun0 initiator-address 192.168.1.0/24 </target> [root@localhost ~]# sudo tgt-admin --dump [root@localhost ~]# The sudoers file includes the line: root ALL=(ALL) ALL
Sorry for the late response. I just saw this. Try the current scsi-target-utils in RHEL 5.6.
Funny one. I confirm the bug/feature for RHEL 5.6:: $ rpm -qf $(command -v tgt-admin) scsi-target-utils-1.0.8-0.el5 $ tgt-admin --dump default-driver iscsi <target iqn.2008-09.com.redhat.example:tgt1> backing-store /dev/sda1 </target> $ sudo tgt-admin --dump $ Reason is PATH Environment is reset by sudo to "/usr/bin:/bin" So this all is the same:: $ sudo tgt-admin --dump $ PATH=/usr/bin:/bin /usr/sbin/tgt-admin --dump $ sudo /usr/sbin/tgt-admin --dump $ sudo bash -c "/usr/sbin/tgt-admin --dump" # workaround (not really;): $ sudo PATH=/sbin:$PATH tgt-admin --dump default-driver iscsi <target iqn.2008-09.com.redhat.example:tgt1> backing-store /dev/sda1 </target>
see bug 80215, I think this is more properly a sudo issue.
Hello, (In reply to comment #4) > see bug 80215, I think this is more properly a sudo issue. I don't consider this as a bug. You can change/set the path either by the workaround described above or using the secure_path Defaults option.