Accessing remote machine via an enviroment variable


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Accessing remote machine via an enviroment variable
# 1  
Old 02-13-2006
Accessing remote machine via an enviroment variable

Hi.
Is it possible to remotely access another unix box via an enviroment variable, on another machine?

I am trying to create an environment variable $MIPSDATA which will point to a folder on another machine.

I have setup the .rhosts file and got that working on both machines (tested via a rsh).

I was trying to use this ...

setenv MIPSDATA misapptst:/data/qldmips

where 'misapptst' is referring to the remote machine...

i.e.

In .rhosts I have this line, which works via the rsh command.

misapptst mipsq

but if I try and do an $ls $MIPSDATA I get ...

ls: misapptst:/data/qldmips: No such file or directory

The directory exists, I know that for sure and it has all the permissions open for anyone to view it.

Any advice? Thanks
# 2  
Old 02-13-2006
what is the exact rsh syntax you're tryig to execute? i'm not sure if you can directly do a remote command without invoking something like rsh, rexec, or ssh command.

the syntax it appears you're trying to use seems to match those that would be used for scp, rcp, and commands like that.

*shrugs*... i think. Smilie
# 3  
Old 02-14-2006
ScatterBrain is right. Are you using the rsh command before the running the ls command? Also, you may have to specify the user to connect to on the remote system.

The syntax of the rsh command would be something like:
rsh -l <user> <command>
# 4  
Old 02-14-2006
My question has changed

Thanks for the responses guys, but I've decided to change my question.

How do I use the concept of the .rhosts file properly? How is it meant to be used?

This is what I have for example ...

Server A (misapptst.melb.hpa):
10.2.64.44 mipsq

Server B (10.2.64.44):
misapptst.melb.hpa mipsq

I can easily do the 'rsh' from server A to server B

ie: $rsh 10.2.64.44 ls

But when I try and do the same from server B to server A, I get this ...

$rsh misapptst.melb.hpa ls
permission denied

Why?

Also, going back to server A... if I try and to a remote copy from server a to server B (since the server B to server A attempt won't allow me)... I get this ...

$rcp 10.2.64.44:/data/qldmips/invoice* .
10.2.64.44:/data/qldmips/: No such file or directory

I know that is NOT true, as that remote folder path does exist!

Smilie

Thanks again for all your time and effort helping me out.
# 5  
Old 02-14-2006
man... it's been a while since i last worked with this kinda stuff...

if i recall correctly (and some of this is a little bit of guessing since it's been a little while since i've seen this stuff so some of the info may be out of whack), the .rhosts file usually lists the hosts and/or users that are allowed to access the machine.

the first thing you may wanna try doing is looking at the .rhosts file on the destination server (that works).... in your case, server B. this .rhosts file apparently allows server A access. if you look at the .rhosts file on server B, it's very possible that the hostname is not mentioned in the .rhosts file... OR the hostname may not be resolvable... or something cazy like that.

also, you may also want to look at the /etc/hosts.equiv file. i THINK the hosts accessing that machine must also be mentioned in that file. note: i THINK the /etc/hosts.equiv file can only be modified by root.

hehe... sorry for all the speculation.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question about enviroment variable.

Hi Gurus, I am stuck on below issue. in my .profile. I have two variable: x=abc$123 t=xyz$ when running env command, I got below: x=abc t=xyz$ my OS is SunOS 5.10 sun4v sparc SUNW,SPARC-Enterprise-T5220 I am wondering why t=xyz$ shows exactly value? I try below: (9 Replies)
Discussion started by: ken6503
9 Replies

2. Shell Programming and Scripting

Help with fetching the data from remote machine from my jumpbox(local machine)

Team, Presently i am running a script from my local box(i.e jumpbox) to all the remote machines.Basically fetching basic queries like pwd,mkdir,touch etc and i am able to successfully fetch it from my local machine.But when i want to check certain database related queries like the dbstat... (20 Replies)
Discussion started by: whizkidash
20 Replies

3. 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

4. UNIX for Advanced & Expert Users

FTP While transfering files to local machine to remote machine

Hi Am using unix Ksh Am getting the problem while transferring zero size files through the script . When i transfer zero size files from local machine to remote machine manually i can able to do it . My question its beause of zero size files am not able to transfer through script ? or its... (2 Replies)
Discussion started by: Venkatesh1
2 Replies

5. Shell Programming and Scripting

Using local variable on a remote machine

Hi, I'm writing a korn shell script where the user enters a variable and I have to create a directory remotely which contains the name of that variable. Example. print 'Please enter variable:' read variable ssh user@host 'mkdir before_$variable;' Thank you. (4 Replies)
Discussion started by: jangozo
4 Replies

6. Shell Programming and Scripting

Define local variable on remote machine ?

Hello, I'm executing many commands using ssh and I want to define local vars on remote machine to ease my work: ssh remote1 <<-heredoc1 cmd1 cmd2 ... heredoc1 This one obviously defines variable on local machine: ssh remote1 "x=10" This one returns: ssh remote1 "'x=10'" bash: x=10:... (1 Reply)
Discussion started by: vilius
1 Replies

7. Shell Programming and Scripting

How to pass enviroment variable from csh to Informix sql script

Hello, I have a csh script that creates an environment variable. I want to pass the environment variable(CURR_TABLE_DATE) to an Informix sql script. Here is the csh: #!/bin/csh -f setenv INFORMIXSERVER market3_tcp setenv CURR_TABLE_DATE 20090714 set DATABASE = gm_cdr set SQL_DIR =... (0 Replies)
Discussion started by: jwoj
0 Replies

8. Red Hat

To find the LATEST file from a dir on REMOTE machine and SCP to local machine?

Hi All, URGENT - Please help me form a scipt for this: I need the LATEST file from a dir on REMOTE machine to be SCP'd to a dir on local machine. (and I need to execute this from local server) I know that the below cmd is used to find the LATEST file from a dir. But this command is not... (3 Replies)
Discussion started by: me_ub
3 Replies

9. Shell Programming and Scripting

Setting environment variable on a remote solaris machine using shell script

Hi, I am trying to set environment variable on a remote machine. I want to do it by running a shell script Here's what I am doin rsh <remote-hostname> -l root "cd /opt/newclient; . ./setp.sh" In setp.sh, I have ############################# cd ../newlib; export... (1 Reply)
Discussion started by: eamani_sun
1 Replies

10. Solaris

set enviroment variable..

Hello... I was wondering can anyone explain me how to set up enviroment variable to be permanent... I tryed with setenv but my solaris does not have this command... then I did: export ORACLE_SID=base1 export ORACLE_BASE=/home export ORACLE_HOME=$ORACLE_BASE/oracle/8.1.6 and by... (5 Replies)
Discussion started by: amon
5 Replies
Login or Register to Ask a Question