Problem with ssh script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem with ssh script
# 1  
Old 10-17-2012
Problem with ssh script

I want to execute below the script for remote server.i am not able to execute below the script please help me urgent for this issue.i getting below the error
Code:
ssh user@server<<EOJ
cd path
for i in *
do
     echo $i
done
EOJ
Pseudo-terminal will not be allocated because stdin is not a terminal.
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
You have new mail.
stty: : Invalid argument



stty: : Invalid argument


Moderator's Comments:
Mod Comment Start using code tags and descriptive subjects. Copy and pasting some line of code as subject isn't very helpful.

Last edited by zaxxon; 10-17-2012 at 03:23 AM.. Reason: code tags, subject
# 2  
Old 10-17-2012
Have you tried something like:
Code:
 ssh user@server "cd path; for i in *; do echo \$i; done"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Ssh script to validate ssh connection to multiple serves with status

Hi, I want to validate ssh connection one after one for multiple servers..... password less keys already setup but now i want to validate if ssh is working fine or not... I have .sh script like below and i have servers.txt contains all the list of servers #/bin/bash for host in $(cat... (3 Replies)
Discussion started by: sreeram4
3 Replies

2. Shell Programming and Scripting

Problem with ssh -n IP

I am able to login to server x from y in shell script. But after that command is get executed on server y. I need the command to be executed on server x. Ex. ssh -n 0.0.0.X ls -ltr Above script I am executing from 0.0.0.Y I got result but it executed on server Y server. But when I use ssh... (4 Replies)
Discussion started by: babapatil14
4 Replies

3. Solaris

Problem with SSH

Hi guys. I am using VirtualBox to run Solaris on my host (Windows 7) . I have setup networking and am able to ping from Solaris to Windows 7 and vice versa. Now I want to be able to SSH from Windows 7 to my guest (Solaris) On solaris , the output to ps -ef | grep ssh shows: ... (8 Replies)
Discussion started by: Junaid Subhani
8 Replies

4. UNIX for Dummies Questions & Answers

Error Executing a script(SSH problem)

Hi i m writing a script which will fetch data from different machines and display it on single terminal. I have created a file named SERVERNAMES containing ip address of machines i need to monitor. Then for every IP i m issuing ssh command to get date on that machine. However When i m trying... (3 Replies)
Discussion started by: pinga123
3 Replies

5. Shell Programming and Scripting

Problem using ssh inside script

Hi, When runnin the following script it complte successfully with out any problem #!/bin/sh SERV="crm1" for s in $SERV do export WebLogicSessions=`ssh psoft@$s "cd /software/psoft/scripts ; ./getweblogicsessions.sh crm1 8001 PIA | awk '{print $1}' ` echo "Checking number of... (0 Replies)
Discussion started by: yoavbe
0 Replies

6. Shell Programming and Scripting

Problem with executing script using ssh

I'm writing a script which is meant to ssh into a remote machine, sed a file there, and write the output to a new file on the remote machine. Obviously the easy way to do this is to write and execute the script on the remote machine, but I'm trying to do this all via ssh since I like to keep and... (4 Replies)
Discussion started by: maethlin
4 Replies

7. Shell Programming and Scripting

ssh script problem problem

Hi Please help me with the following problem with my script. The following block of code is not repeating in the while loop and exiting after searching for first message. input_file ========== host001-01 host001-02 2008-07-23 13:02:04,651 ConnectionFactory - Setting session state... (2 Replies)
Discussion started by: pcjandyala
2 Replies

8. UNIX for Advanced & Expert Users

problem with ssh

Hi I am using ssh and facing problem. When I execute a command which is my application specific it hangs after giving initial message.Program does not return to command prompt but process is completed in background. e.g I run following command $ dtsbackup... (4 Replies)
Discussion started by: shreedhar_tase
4 Replies

9. UNIX for Dummies Questions & Answers

Problem with SU or SSH in shell script

Hi Floks! This is Sravan! I am new to linux and I am trying to write bash shell script in which I want to change the user but the statements which are after the "su " command are not working that I mean I want to execute some statements as the changed user here is the code ... (2 Replies)
Discussion started by: sravanp
2 Replies

10. UNIX for Advanced & Expert Users

SSH Problem auth problem

Hi, Just recently we seem to be getting the following error message relating to SSH when we run the UNIX script in background mode: warning: You have no controlling tty. Cannot read confirmation.^M warning: Authentication failed.^M Disconnected; key exchange or algorithm negotiation... (1 Reply)
Discussion started by: budrito
1 Replies
Login or Register to Ask a Question