auto login to Super User account

i want to write to script which will login to su account without hving user interaction.( i know Super user password)
i wrote following script its also able to log into su account. but seesion gets terminates soon.
what can be done ???
or is there any other solution. i don't want to use expect tool :frowning:

HOST="host ip address" # have to put host ip address
DELAY=1

USER="anup"
UPASS="user password"
SUSER="root"
SPASS="root password"
ACC=6
#exec 4>&2

telnet $HOST >&2 2>&2 |&
sleep $DELAY
print -p $USER
sleep $DELAY
print -p $UPASS
sleep $DELAY
print -p $ACC
sleep $DELAY
print -p login 
sleep $DELAY
print -p $SUSER
sleep $DELAY
print -p $SPASS

please help me out
thanks and regards :slight_smile:

Dont get you here:
If there is no user interaction then you are talking batch... in batch when execution is finished the shell exits...
If its only to not have to pass a passwd, why not just use rlogin or remsh (rsh) with .rhosts file or even better: ssh

i don't have ssh installed and cant install also. can you tell me how to use rsh with .rhosts.
actually i m writing script so that user can login to root account without entering password. like automated login.

You could even do it on the same box...(rlogin to itself...)
In root's directory you create a file calles .rhosts with per line :
<hostname> <user>
you chmod the file 400
depending of platforms you may need to add the <hostname> and ip in /etc/hosts
some configure /etc/hosts.equiv....

Start by your own account and let you remsh on another box, once youve seen how it works try to figure out the best way for you in terms of security...

Thinking of it cant you install sudo? there is an option no passwd...

Wasap guys

I work for a software company which uses AIX and Korn shell.
I'm new to shell scripting and Unix in general, I'm trying to write a batch file or script , which pypass rlogin, typing user name, password and dialing a client remotly.
So, I've created the following

rlogin SGGORA1
input 'userid?';
type LF;
waitfor 'Password', 3 seconds : nolog;
input nodisplay 'passowrd?';
type LF;

call NESIMA

had to mention
-We don't have ssh installed
-no input found when I type which input
SGGORA1 still ask me for a user id and password.

Can you please help
Thank you
zech

Putting the root password in a script is very bad.

Don't do it.

No thats not the root password.. its the user passowrd.
I tried rlogin -l <user>, so I was able in bypassing typing the user id.. but dont know how to bypass the password one.