Switch user terminal error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Switch user terminal error
# 1  
Old 02-04-2015
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:

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

But the error I get..
Code:
su: must be run from a terminal

Smilie

Can you please help? Smilie

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..
# 2  
Old 02-04-2015
So - what's the question that remains?
# 3  
Old 02-05-2015
Hello Rudic

I am sorry if I was not clear enough..Smilie

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

Code:
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
# 4  
Old 02-05-2015
man ssh:
Quote:
-t Force pseudo-tty allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing
menu services. Multiple -t options force tty allocation, even if ssh has no local tty.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to switch user in shell script?

HI in a server we can't login with root user directly but i can login with different user and then i can switch to root user by su command Requirement is there anyway where i can write a script without mentioning password in file as mentioning the root password is not the... (3 Replies)
Discussion started by: scriptor
3 Replies

2. Shell Programming and Scripting

How to Switch from Local user to root user from a shell script?

Hi, I need to switch from local user to root user in a shell script. I need to make it automated so that it doesn't prompt for the root password. I heard the su command will do that work but it prompt for the password. and also can someone tell me whether su command spawns a new shell or... (1 Reply)
Discussion started by: Little
1 Replies

3. Linux

Switch Desktop Environments via Terminal

Hi All, Does anyone know if it's possible to switch desktop environments via the terminal? I'm writing a script to install Cinnamon on Ubuntu and I would then like to remove unity but at the moment I have to ask the user to log out, log in with cinnamon and then continue the script to remove... (1 Reply)
Discussion started by: maerlyngb
1 Replies

4. Shell Programming and Scripting

switch user from local user to root in perl

Hi Gurus, I have a script that requires me to switch from local user to root. Anyone who has an idea on this since when i switch user to root it requires me to input root password. It seems that i need to use expect module here, but i don't know how to create the object for this. ... (1 Reply)
Discussion started by: linuxgeek
1 Replies

5. Shell Programming and Scripting

switch as another user without password

I want to switch as another user without using password .Is it posiible ? I have one server B and I have logged in as username u1 but I want to login to that same server using username as u2 but I don't want to give the password for u2. (3 Replies)
Discussion started by: maitree
3 Replies

6. AIX

Switch user(su) two times

Is it possible to switch to root(if allowed) and then with root privileges switch to another user account "ABC"? To further explain the scenario, ABC is an account which has sugroups=su2DEF and root is not part of su2DEF group. but, given that root can switch to any account(correct me if I am... (7 Replies)
Discussion started by: mtwain
7 Replies

7. Shell Programming and Scripting

Switch to different user without expect

Hi, I have to switch to a different user and execute certain commands and then come back to the original user Ex: My id is 'usstage'. I need to switch to 'apstage', souce a script there, execute a function and then get back again to usstage. Please note that I do not have expect installed... (4 Replies)
Discussion started by: sugan
4 Replies

8. UNIX for Dummies Questions & Answers

Expect command to switch user

Hi I have written a script to switch user and do some operations. I used expect command it doesn't work. It switches the user and waits for the Password to be entered manually. Also, i tried to fetch the pasword from passwd file, it didn't work.The script is as below: ... (4 Replies)
Discussion started by: Sapna_Sai
4 Replies

9. Shell Programming and Scripting

Non-interactive user switch to root

Is is possible switch user from a non-root user to root user without entering the password interactively inside a korn shell script which is run by a non-root user? e.g. I have a non-root user called infodba who is in dba group and I want to create a shell script which is executed by infodba... (5 Replies)
Discussion started by: stevefox
5 Replies

10. UNIX for Dummies Questions & Answers

How to switch between terminal screens in Sun Solaris 10

:) Hi everybody.. This is my firt post in this great forum.: I have installed Sun Solaris 10 on an Intel machine.. Now i login in CDE desktop as root. I want to switch between terminal screens pressing CTRL+ALT F1 (through F6) but nothing happens ?? any suggestions thank you (2 Replies)
Discussion started by: peterpan
2 Replies
Login or Register to Ask a Question