Operating System - HP-UX
1822001 Members
4206 Online
109639 Solutions
New Discussion юеВ

Problem with shell (automatic login)

 
pareshan
Regular Advisor

Problem with shell (automatic login)

Hi Everyone, I got the task writting Korn Shell script to automate the tuxedo login so that users neednot have to enter options manually. I have done that using expect tool from the Unix but my manger told me its not secure so you have to do that using Kornshell without using Expect. Here is the way to login to that tuxedo account
1> first we have to ssh to the unix server and from there we have to do
get_in_tux.csh account_name

2> it will prompt
To continue press ENTER ...
3> after enter we will get
JULIET: Press Enter to continue ...

4> after enter it will prompt for
JULIET - Your Tuxedo Administrator C.P: Main menu
Main menu:

(1) DB handling ->
(2) Tuxedo handling ->
(3) CAS handling ->
(4) Client operations ->
(5) Logs ->
(6) General utilities ->
(7) Help ->
(8) WebLogic handling ->
(9) What's new ...

(0) Quit JULIET

Please select option :

here we can choose either of these options

s for to go to shell
and 0 (zer0) for logout

I know its a big problem but I am really in big trouble. So I need such a script which can automate all this steps so that we dont need to provide those options and we can directly enter into those account and logout if needed sitting in the remote server.

Thank You In advance
Any help will be appreciated
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor

Re: Problem with shell (automatic login)

Hi:

> but my manger told me its not secure so you have to do that using Kornshell without using Expect...I know its a big problem but I am really in big trouble. So I need such a script which can automate all this steps...

So, you want us to write you a script so that your manager will be happy with *you*...I suggest you either send $$$ or at least post what actual code you have developed and where you are having problems.

Regards!

...JRF...
pareshan
Regular Advisor

Re: Problem with shell (automatic login)

The code i have written down is using expect. i.e. pretty simple
#!/usr/local/bin/expect

spawn rlogin servername -l account_id

expect "password:"
send "password\r"


expect "ENTER ..."
send "\r\r"

expect ":"
send "s\r"

expect ">"
send "exit\r"

expect "ENTER ..."
send "\r"


expect ":"
send "0\r"

expect eof


In this code I have used rlogin to connect to that server which have tht tuxedo account and i have to provide password also so its visible to everyone. the right way to login into that account is

using

get_in_tux.csh account_id but if we do this as I told before we have to do it manually we have to press ENTER choice and some options after that.

I even tried to edit the code inside get_in_tux.csh and tried to skip those steps but I dont have a clue whats going on in that code and where I can write code for that. I can even provide the code inside that get_in_tux.csh if Necessary
thank you
OldSchool
Honored Contributor

Re: Problem with shell (automatic login)

ok, i know zero about tuxedo and you're expect script doesn't offer a clue as to the "options" you say you need to specify, however your manager is correct, rlogin and the password in expect is very unsecure.

suggest that you set up ssh and public key authentication, at least for the account you need to access. then you can do something like

ssh juliet_user@host.whatever "your script on host.whatever"

"your script on host.whatever" may be able to use a "here-doc" to supply the correct keystrokes, provided tuxedo reads stdin as normal.

man "your shell" for here-doc details.
pareshan
Regular Advisor

Re: Problem with shell (automatic login)

actually i found out we cannot do automation of the script that im looking for coz its an application which calls another application so we cannot do anything about it and only possible way is using expect