AIX

AIX

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


#Power
 View Only
Expand all | Collapse all

su: BAD SU from myuserid to root at /dev/pts/0

  • 1.  su: BAD SU from myuserid to root at /dev/pts/0

    Posted Wed September 02, 2015 11:37 AM

    Originally posted by: IbnuHaroon


    Hi,

    I have been using the following command and scripts (Please refer below scripts)  in my 2 servers and whenever the below script got executed i am getting the following error message in server security logs.

    Message forwarded from server2: su: BAD SU from administrator to root at /dev/pts/0

    Is this possible to stop getting the above error message? Any idea what in my below script causing this error message?  Any suggestions to improve the below scripts?

    My Servers are running AIX 6.1 TL8

     Scripts:-

    At Server 1:
    ssh administrator@server2 "/usr/tmp/scripts/changetoroor.exp"

     

    At Server2 , contents of the above script is /usr/tmp/scripts/changetoroot.exp


    #!/usr/bin/expect
    spawn su - root -c "sh /usr/tmp/scripts/DB_Script.sh"
    expect "Password:"
    send "mypass***"
    interact

    At Server2 :usr/tmp/scripts/DB_Script.sh


    #!/bin/sh
    TIMESTAMP=`date | awk '{print $3_$2_$6_$4}'`
    su - mydb2account -c "db2 set write resume for database > /usr/tmp/scripts/logs/$TIMESTAMP.resume.log"


    #AIX-Forum


  • 2.  Re: su: BAD SU from myuserid to root at /dev/pts/0

    Posted Fri September 04, 2015 06:00 AM

    Originally posted by: Wouter Liefting


    Take a look at sudo. It's far more suitable to what you're trying to achieve. And it doesn't require you to store the unencrypted root password in public scripts.

    Alternatively, just do "ssh root@server2 /usr/tmp/scripts/DB_Script.sh". That skips the whole su step.


    #AIX-Forum