ssh connection from remote machine in solaris


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ssh connection from remote machine in solaris
# 1  
Old 06-17-2010
ssh connection from remote machine in solaris

Hi!

I have two solaris 10 machines(say 10.1.1.1,10.1.1.2). i have installed rsync on 10.1.1.2,

Code:
10.1.1.1:::
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
-bash-3.00$ ssh 10.1.1.2 "echo $PATH"
Password:
/usr/java/bin:/home/ppoker/thirdparty/ruby/bin:/usr/bin:/usr/ant/bin:.:/usr/local/bin:.:/usr/java/bin:.:/usr/local/apache2/bin:.:/home/ppoker/bin
-bash-3.00$ ssh 10.1.1.2 "which rsync"
Password:
no rsync in /usr/bin
-bash-3.00$

10.1.1.2::::::
-bash-3.00$ which rsync
/usr/local/bin/rsync
-bash-3.00$

when i execute the command from another machine through ssh, why is it unable to find the rsync command?

regards,
Kiran

Last edited by pludi; 06-17-2010 at 05:06 AM.. Reason: code tags, please...
# 2  
Old 06-17-2010
Hi.

Code:
-bash-3.00$ ssh 10.1.1.2 "echo $PATH"

Would show the PATH on 10.1.1.1.

Use single quotes, or escape the $ in $PATH.

Code:
-bash-3.00$ ssh 10.1.1.2 'echo $PATH'

or
Code:
-bash-3.00$ ssh 10.1.1.2 "echo \$PATH"

to see what the path actually is on 10.1.1.2
# 3  
Old 06-17-2010
Non interactive ssh sessions do not read profiles. You can do one of these:

First, you can change the default path in /etc/default/login, let's say:
Code:
PATH=/usr/bin:/usr/local/bin

but this affects all users.

Another way is to write
Code:
PATH=/usr/bin:/usr/local/bin

into ~/.ssh/environment. But to make this work, you first have to allow user environments in sshd_config:
Code:
PermitUserEnvironment yes

Be advised, that this may have security related side effects depending on your scenario.
# 4  
Old 06-17-2010
@scottn!! you are correct...it is showing in path of 10.1.1.1, i escaped the $ and it is now showing correct path::
Code:
10.1.1.1:::
-bash-3.00$ ssh 10.1.1.2 "echo \$PATH"
Password:
/usr/bin
-bash-3.00$

@hergp
i checked /etc/default/login file, but path variable is commented in that file.
Code:
//code from /etc/default/login file
# PATH sets the initial shell PATH variable
#
#PATH=/usr/bin:

in this case from where it is taking PATH variable for ssh connection?

Regards,
Kiran

Last edited by Scott; 06-17-2010 at 06:13 AM..
# 5  
Old 06-17-2010
If PATH is commented out in /etc/default/login, then the compiled-in default-default-path is used, which is /usr/bin.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. BSD

Connection SSH to remote by ssh

Hello guys! I am setting up a script to access a unix remote server. My problem is that when I put the ssh line "my host", the script does not wait for the server response asking for the password to execute the line in which I put the password, that is, I need to put a form in which script has a... (1 Reply)
Discussion started by: aroucasp
1 Replies

2. Red Hat

iptables applied in local machine, can't ssh remote machine after chain changed to DROP

I want to SSH to 192.168.1.15 Server from my machine, my ip was 192.168.1.99 Source Destination was UP, with IP 192.168.1.15. This is LAN Network there are 30 Machine's Connected to the network and working fine, I'm Playing around the local machine's because I need to apply the same rules in... (2 Replies)
Discussion started by: babinlonston
2 Replies

3. Shell Programming and Scripting

How can i get the logged in host machine ip in a ssh connection?

Hi All, I have a basic question. In my system i maintained multiple unix server, and only one server has public ip, and all the servers are behind load balancing BIG ip server. To access any server, user need to access server with public IP then from there they can establish ssh connection to... (2 Replies)
Discussion started by: dilipsn
2 Replies

4. AIX

ssh failed to login in remote connection

i am in node acbs01b and i use the root@fcbs01b to login and i have the below message . ssh root@fcbs01b @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT... (6 Replies)
Discussion started by: thecobra151
6 Replies

5. Red Hat

Unable to SSH into machine - ssh_exchange_identification: Connection closed by remote host

For a few days now I have been experiencing issues when trying to SSH into 1 of my machine. I get the following output when running 'ssh -vvv': server1:/home/mymadq> ssh -l root -vvv server2 OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003 debug1: Reading configuration data /etc/ssh/ssh_config... (3 Replies)
Discussion started by: jaapar
3 Replies

6. UNIX for Advanced & Expert Users

"Connection closed by remote host" while doing ssh to a solaris box

Hi All, When i try to do ssh from a linux to solaris box its throughing "Connection closed by remote host". Please not that this error is not occuring every time i do ssh, it occurs at random timing( Mostly ssh is successful) - unfortunately my script which is doing ssh is falling at this time... (4 Replies)
Discussion started by: pkumar7
4 Replies

7. Shell Programming and Scripting

check ssh connection to remote host

I am using KSH and I need to check whether the remote host has been configured with ssh public key. Is there any way we can check inside a script? (6 Replies)
Discussion started by: praveenbvarrier
6 Replies

8. Shell Programming and Scripting

Remote SSH Connection Using Script

Hi, I am new to Shell Scripting. Can anybody help me in writing a Script Which Could Login from a Unix box to a Remote Unix box which accepts the user credentials automatically and display the result for checking the Disk Space Utilisation (Without running any SSH agent). (1 Reply)
Discussion started by: ajith_tg
1 Replies

9. Shell Programming and Scripting

Remote Connection (SSH)

Hello all, I connect usually to one enviornment "dev" daily and then ftp some files to some other enviorment "uat" and then login to "uat" and run some scripts to process these files. I was thinking to automate the process, where running one script from "dev" will complete all task required... (11 Replies)
Discussion started by: RishiPahuja
11 Replies

10. UNIX for Advanced & Expert Users

Solaris 9 remote login (ssh) drops connection

Hello All, I wonder if you can help me... Let me give you some set-up details before I ask you the question. I have Ultra-60 at home with Solaris 9 and recommended patch cluster installed. The machine is connected to a Linksys WAG54G ADSL router/modem through RJ45 ethernet cable. The... (2 Replies)
Discussion started by: ahmerin
2 Replies
Login or Register to Ask a Question