AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
  • 1.  bug for su command or ksh?

    Posted Thu March 12, 2009 10:57 PM

    Originally posted by: SystemAdmin


    Hi,

    Really need some aix gurus to help me on this issue, here is the scenario.


    Running AIX53TL07SP1 or AIX53TL07SP4, all run by root.


    1. Create a K-shell script called su-test under /tmp as below, change to excutable after vi.

    #!/usr/bin/ksh

    /usr/bin/su - users

    2. go to /tmp and run the script.

    ./su-test

    sometimes, the script would work and lead me to /home/users, but sometimes, it also works, however, the sub-shell would close right away and back to root.


    So question here is :

    What's the difference between run su command directly and run that script? since if I run su command directly, I would not have this issue at all.

    Any feedback is really appreciate.


    Here is more tech details for environment:

    Running openssh on the server, if we use console login by root directly, the script would work fine.


  • 2.  Re: bug for su command or ksh?

    Posted Sun March 15, 2009 02:04 PM

    Originally posted by: nagger


    I think you will have to determine what you mean by "sometimes".
    Forum's like this are not good at determining what your problem is on you specific machine.
    Are you running out on paging space? are their limits on the numbers of users?

    Can you add the id command before and after the su
    to help determine the user before you run su?
    Can you change the PS1 so its very clear the user you are using.
    I suspect you are running it once and then not clear on the user and it would fail it you run the script as the user users (by the way that is a really confusing user name).

    Best of luck , Nigel


  • 3.  Re: bug for su command or ksh?

    Posted Sun March 15, 2009 11:47 PM

    Originally posted by: SystemAdmin


    good comments, very appreciate.

    I had a PMR already for IBM, they are doing test now, we had test about 10 AIX53TL07 servers, include sp1 and sp4, all have the same issue, looks like a bug on TL07, we also test a server with TL08, so far so good, I am pending on IBM aix support feedback.

    So far, they had asked me run truss command with the scipt, however, after we use truss command with the script, the issue has been gone, I will put more details in tomorrow.

    thanks again.


  • 4.  Re: bug for su command or ksh?

    Posted Mon March 16, 2009 04:23 PM

    Originally posted by: SystemAdmin


    Hi, here is the scernario, you could see the last time su command just jump back to root env directly, the user123 subshell crashed.


    root server1 /tmp: oslevel -s
    5300-07-04-0818
    root server1 /tmp:



    root server1 /tmp: cat su-test
    #!/usr/bin/ksh

    /usr/bin/su - user123



    root server1 /tmp: ls -al /usr/bin/su
    -r-sr-xr-x 1 root security 32252 Aug 23 2007 /usr/bin/su
    root server1 /tmp: file /usr/bin/su
    /usr/bin/su: executable (RISC System/6000) or object module
    root server1 /tmp:



    root server1 /tmp: id
    uid=0(root) gid=0(system) groups=2(bin),3(sys),7(security),8(cron),10(audit),11(lp)
    root server1 /tmp:



    root server1 /tmp: ulimit -a
    time(seconds) unlimited
    file(blocks) unlimited
    data(kbytes) 131072
    stack(kbytes) 32768
    memory(kbytes) 32768
    coredump(blocks) 2097151
    nofiles(descriptors) 2000
    root server1 /tmp:

    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123: exit
    root server1 /tmp: ./su-test
    user123 server1 /home/user123:
    root server1 /tmp:


    root server1 /tmp: errpt |head
    IDENTIFIER TIMESTAMP T C RESOURCE_NAME DESCRIPTION
    EC0BCCD4 0214003009 T H ent2 ETHERNET DOWN
    EC0BCCD4 0212142809 T H ent2 ETHERNET DOWN
    EC0BCCD4 0211132609 T H ent2 ETHERNET DOWN




  • 5.  Re: bug for su command or ksh?

    Posted Sun March 22, 2009 08:32 PM

    Originally posted by: SystemAdmin


    The script that you are running is being run in a subshell. When the subshell completes, it exits and returns you to your current shell as root.

    Possibilities:

    1. Run the script in the current shell; e.g. . script

    2. Run using: exec script (this replaces the current shell).