Commands not working with ssh remote login


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Commands not working with ssh remote login
# 1  
Old 06-24-2016
Debian Commands not working with ssh remote login

Hi Friends,

I am unable to run our application commands on remote server using ssh (passwordless login enabled). But the same command running with telent perl script. please suggest.

SSH:
Code:
C:/bin>ssh -l monitor tl04cp01 exec "/home/monitor/123"
/home/monitor/123[2]: viewlog:  not found.

Telnet: (perl)
Code:
C:/bin>cat test.pl  <---- (perl script to login with telnet)
#! /usr/bin/perl -w
use Net::Telnet ();
$hostname = "$ARGV[0]";
$username = "$ARGV[1]";
$password = "$ARGV[2]";
$t = new Net::Telnet ( Timeout=>20, Errmode=>'die');
$t->open("$hostname");
$t->login("$username","$password");
@alarm = $t->cmd("/home/monitor/123");
print @alarm;

Successfully executed:
Code:
C:/bin>./test.pl 10.110.200.1 user121 'xxxxxx'

PAGE: 1                                                               
Measurements date: Jun 23, 2016                                    Generation date: Jun 24, 2016
Measurements time: 00:00-24:00 IST                                 Generation time: 00:02:36 IST



Moderator's Comments:
Mod Comment Please use code tags as required by forum rules!

Last edited by RudiC; 06-24-2016 at 03:50 AM.. Reason: Added code tags.
# 2  
Old 06-24-2016
Unable to decipher and understand the logics, I still guess that you are using different users (monitor/user121) and hosts (tl04cp01/10.110.20.1).
# 3  
Old 06-24-2016
Yes. users may differ. but, the script which my application is using is not executing with ssh and same is working with telent login
# 4  
Old 06-24-2016
Are you aware that the environment may be seriously different for two users? That might be the reason for the logged error.
# 5  
Old 06-24-2016
Hi,

I tried with same user, still getting same error. Do we need to enable any thing extra for ssh login?
# 6  
Old 06-24-2016
For both logins, post the environment and the path to viewlog.
# 7  
Old 06-24-2016
Thank you so much , it is working now.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remote ssh commands

ssh XXXXX@XXXXX'. $HOME/.profile 2>/dev/null;cd $COMMON_TOP/admin/scripts/$CONTEXT_NAME; adcmctl.sh start "apps${AppsPass}" || cd $ADMIN_SCRIPTS_HOME; adcmctl.sh start "apps${AppsPass}"' As per our business requirement we should be able to execute the above two commands seprated with or ( || )... (4 Replies)
Discussion started by: Y.balakrishna
4 Replies

2. Shell Programming and Scripting

Login to remote host and execute commands

Hi, i want to write script where it will login into 50 hosts and if login is successful it print message "login to host1 is successful" if not it should print message "Not able to login to host1". once connection to the host is succesful it should fire df command to check filesystem if df is... (3 Replies)
Discussion started by: amru8810
3 Replies

3. Shell Programming and Scripting

Executing remote commands via ssh

Hi, I'm tryin to write a script that will collect information about a remote servers, put them into variables and print them to screen. # /usr/bin/bash ls $1 > /dev/null 2>/dev/null if then echo "$1 is file" for server in $(cat $1) do # echo $server ... (5 Replies)
Discussion started by: moshesa
5 Replies

4. Solaris

how to login with ssh to remote system with out applying the remote root/usr password

how to login with ssh to remote system with out applying the remote root/user password with rlogin we can ujse .rhosts file but with ssh howits possible plz guide (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies

5. Shell Programming and Scripting

SSH, Remote Commands and echo, oh my!

So, HostB has a SSH trust via pre-shared keys from HostA. HostA> ssh HostB hostname HostB HostA> ssh HostB echo `hostname` HostA HostA> ssh HostB 'echo `hostname`' `hostname` HostA> ssh HostB "echo `hostname`" HostA HostA> ssh HostB echo $PS1 user@HostA:$PWD HostA> ssh HostB... (12 Replies)
Discussion started by: Wrathe
12 Replies

6. Shell Programming and Scripting

remote ssh commands help

I have a script that I'm trying to use that will check for files on a remote machine and if there is files copy the files, modify the perm on the copied files, and then delete the files off of the remote server. Right now I need to get the correct syntax so the the remote commands still interpret... (4 Replies)
Discussion started by: jcalisi
4 Replies

7. Solaris

Remote ssh login as root

I edited my /etc/default/login file and commented the line: # If CONSOLE is set, root can only login on that device. # Comment this line out to allow remote login by root. # #CONSOLE=/dev/console I still cant login thru telnet or ssh. What else do i have to do to be able to login... (14 Replies)
Discussion started by: BG_JrAdmin
14 Replies

8. Shell Programming and Scripting

Remote login through ssh

Hi , I need to login to remotemachines through ssh and move some logfiles to my localmachine. My servername,username and password will be store in the .profile file. can any one please help me in this? This will be a cronjob so Password can't be enter at run time. Thanks in advance Subin (5 Replies)
Discussion started by: subin_bala
5 Replies

9. Solaris

CDE Remote Login is not Working !!!

Hi , I have SunBlade 150 Workstation (Solaris 9), I installed the OS again then when I try to login to any server using ( Options > Remote Login > Enter Host Name) after I entered any host name nothing happened just white page for 2 or 3 mintues then the login screen reseted to the local... (4 Replies)
Discussion started by: adel8483
4 Replies

10. UNIX for Advanced & Expert Users

SSH remote login problem

Hi: I have been given the responsibility of administering AIX 3.1 machine in my lab recently. And, I am having trouble logging on to the machine using SSH through windous systems. Thus, now no one is able to access it!! The following error message is displayed when I tried to login: "The... (3 Replies)
Discussion started by: pdepa
3 Replies
Login or Register to Ask a Question