Switch user terminal error

Hello All,

Here I am trying to login a Linux machine as admin user from a Solaris box..

& then switch to root user..

Code I use:

ssh admin@<IP> << END
su - root  << A
echo "Hello I am logged in as root"
exit
A
exit
END

But the error I get..

su: must be run from a terminal

:eek:

Can you please help? :confused:

BR
Nil

---------- Post updated at 05:48 PM ---------- Previous update was at 05:47 PM ----------

Sudo does not help.. Because the commands I am going to use does not allow using sudo..

So - what's the question that remains?

Hello Rudic

I am sorry if I was not clear enough..:o

Problem I am facing here, Using the script I am not able to switch user to root in the remote Linux machine due to the error

su: must be run from a terminal

Can you please advice? Am I missing something in my script?

Note: I am able to switch to root after a manual login in the Linux machine..

BR
Nil

man ssh :