Running script and commands through SSH


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Running script and commands through SSH
# 8  
Old 04-14-2011
Yes, but your shell, what is it? When you ssh in you get bash, what do you get when you do so "locally"?
# 9  
Old 04-14-2011
Yes, I am running bash in both.

---------- Post updated at 05:22 PM ---------- Previous update was at 03:16 PM ----------

I have now discovered new thing which will be probably the problem, but still don't know how to solve it.

When I am logged to Solaris system bu ThinLink there is several options for running terminal. When I run Terminal on solaris then I get same user name as when using shh, which is gray1(dava) $. And it is doing same thing and I am not able to execute the commands.

While I used terminal (not sure what kind, it just say terminal) then I get user name "n-62-13-32(dava) $, and with this terminal I am able to do what I want.

I guess it can be somehow related to the problem. Maybe I am just logging-in in wrong way.

Last edited by Apfik; 04-14-2011 at 09:16 PM..
# 10  
Old 04-15-2011
Quote:
Originally Posted by Apfik
When I am logged to Solaris system bu ThinLink there is several options for running terminal.
Which are what?
Quote:
When I run Terminal on solaris then I get same user name as when using shh, which is gray1(dava) $. And it is doing same thing and I am not able to execute the commands.

While I used terminal (not sure what kind, it just say terminal) then I get user name "n-62-13-32(dava) $, and with this terminal I am able to do what I want.
For one reason or another, different profiles are being loaded when you login one way than another.

Try echo $SHELL ; echo $USER in both to make double-sure you're actually running bash, and as the same user.

You could run exec bash -l to make sure you're running in your preferred shell.
# 11  
Old 04-15-2011
Quote:
Originally Posted by Corona688
Which are what? For one reason or another, different profiles are being loaded when you login one way than another.

Try echo $SHELL ; echo $USER in both to make double-sure you're actually running bash, and as the same user.

You could run exec bash -l to make sure you're running in your preferred shell.
Everything is identical on both, shh log in as well as on machine which I log to by ThinLink.

I really thing that the problem is that I am logged to wrong server, because I have just find that there are three different types of servers and I need to be probably logged to application servers which I am apparently not when I am using shh. I have contacted support of the servers but it will take some time to get answer back. When I will get an answer I will post it here too, if it will solve the problem

Thank you very much for your help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ssh - running commands on remote server

Hi, I am trying to run commands on a list of servers that I can ssh to and just want to know if there is a 'cleaner' way of doing this. At the moment, I am doing as below. Is there a way that I can escape the double quote differently? If a use a single quote to enclose the commands that I... (1 Reply)
Discussion started by: newbie_01
1 Replies

2. Shell Programming and Scripting

Perl script running multiple commands at once

Hi All, I have put a perl script together to go and collect some information from multiple nodes/endpoints. The script works absolutly fine however I want to make it quicker. You will see in the below that my script calls an expect script called ssh_run_cmd2.exp followed by the IP of... (7 Replies)
Discussion started by: mutley2202
7 Replies

3. Shell Programming and Scripting

Running Commands on a Remote Linux Server over SSH

Hello, I'm trying to create a ksh script to ssh to a remote server, enter the password and a couple commands. For security reasons I have changed the login, password and ip in my example. #!/bin/ksh ssh -t -t username@12.5.5.3 << EOF password cd bin pwd EOF When I run it. It... (5 Replies)
Discussion started by: seekryts15
5 Replies

4. Shell Programming and Scripting

Issue with running commands from shell script

I'm trying to copy files from a remote windows server to Unix server. I was successfully able to copy files from windows server using command prompt but when I run these commands from a script it's not working as expected. commands used: sftp user@remoteserver.com lcd local_dir cd... (3 Replies)
Discussion started by: naresh7590
3 Replies

5. Shell Programming and Scripting

Execute ssh commands through bash script

Hi all! I am trying to write a script that will check if a certain directory is available at several different nodes and then do stuff in it ..... On the beginning of the script I give as a variable the directory and the number of the nodes and then I loop like this: for... (3 Replies)
Discussion started by: idet2
3 Replies

6. Shell Programming and Scripting

Alert for long running commands in script

Hi All, Is there a way in which a long running command can terminate by itself inside a script? I need something like below: echo Start <command> exit If the <command> is taking more than say 100 seconds to complete, the script should exit without manual intervention. Thanks, Deepak (2 Replies)
Discussion started by: deepakgang
2 Replies

7. Shell Programming and Scripting

Running unix commands in a perl script

Executing two unix commads via perl script one after another e.g: make clean bsub -i -q short make have tried using exec but the second command doesnt executes (1 Reply)
Discussion started by: rajroshan
1 Replies

8. Shell Programming and Scripting

running script in cron - with ssh commands - not working

I ran an ssh command to run a script on a remote server ssh -l <user> <servername> /path/to/script/scriptname This works fine - and the script is executed correctly. However - I put this command into a script, that I want to run from cron every hour, to execute the file on the remote... (31 Replies)
Discussion started by: frustrated1
31 Replies

9. Shell Programming and Scripting

Adding ssh commands to a shell script

I have written some scripts that do a few admin tasks on 23 servers I manage. Usually I execute these scripts from one server by running ssh commands remotley, i.e. ssh root@server2 shellscript, ssh root@server2 shellscript & so on.. It works fine but I want to improve this by writing a... (3 Replies)
Discussion started by: Moxy
3 Replies

10. Shell Programming and Scripting

running commands from script

I'm new to unix and I have a fairly simple problem: Lets say I am in a specific directory and I run the command: "dirs" , I get an output of all the folders that i pushed into the stack (as expected), buut, when when I create a script (called test): #! /bin/csh dirs and then i run:... (2 Replies)
Discussion started by: owijust
2 Replies
Login or Register to Ask a Question