Bug 186879 - su -c "command" has no controlling terminal anymore
su -c "command" has no controlling terminal anymore
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Depends On:
  Show dependency treegraph
Reported: 2006-03-27 03:32 EST by Karel van Houten
Modified: 2017-03-11 17:27 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-03-27 03:40:22 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Karel van Houten 2006-03-27 03:32:12 EST
Description of problem:

When using su -c "bash" (for example), the resulting bash shell has no access to
its controlling terminal (/dev/tty), so there is no job-control possible, and
tools like 'resize' fail.

Version-Release number of selected component (if applicable):
coreutils 5.93 (bug was not present in the FC4 version 5.2.1)

How reproducible: allways.

Steps to Reproduce:
1. su root -c "bash" (enter password)
2. cat
3. type ^C to interrupt.
Actual results:
[karel@fc5 karel]$ /bin/su root -c "bash"
[root@fc5 karel]# cat
(type ^C)
Session terminated, killing shell... ...killed.
(session hangs, with 2 processes reading from terminal)

Expected results:
[karel@fc5 karel]$ /tmp/su4 root -c "bash"
[root@fc5 karel]# cat
(type ^C)
[root@fc5 karel]# exit

Additional info:
Comment 1 Tim Waugh 2006-03-27 03:40:22 EST
Use '-s' to run a particular shell.  -c is not for interactive commands.
Comment 2 Karel van Houten 2006-03-28 00:37:20 EST
I've made a workaround based on the -s option. But I disagree that this is not a
bug. I have scripts, that start an interactive command, using su -c, where the
command has to accept arguments. This is not possible with the -s option.  These
scripts have worked on all unix versions (hpux, solaris), up to Fedora 4, and
now starting with Fedora 5, I have to code these scripts different for linux and
other unices. I don't think that is the way to go for unix.


Note You need to log in before you can comment on or make changes to this bug.