RSH and .profile


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting RSH and .profile
# 1  
Old 03-18-2005
RSH and .profile

Hello all,

Here's my problem:

When i try to execute a command using rsh (ksh on AIX 5.1):

rsh <host> -l <user> -c <command>

the .profile is not executed.
Is there a solution ?

Thanx
# 2  
Old 03-18-2005
.profile gets executed only when you login interactively. But rsh just try to execute the command you desired to execute, and in order to execute the command successfully, it need to verify the right user name. Hence passing the user name will not just make the .profile to get executed.
# 3  
Old 03-18-2005
add user in the .rhosts file.
# 4  
Old 03-22-2005
Thank you for your replies,

.rhosts and hosts.equiv files are OK. The rsh command is executed but not the .profile.
I've tried to combine the 2 commands like this : (. ~user/.profile ; command ) but this syntax doesn'nt seems to work.
Is there really no solution ?
# 5  
Old 03-22-2005
Not by any means an rsh expert but I would try ". ~user/.profile ; command"

Perhaps someone else has another suggestion if that does not work.
# 6  
Old 03-22-2005
Yes, this form works but .profile and command are executed in 2 differents processes so the environment defined in .profile is not known by the second process.

Another idea?
# 7  
Old 03-22-2005
Create a script to run on the second system that sources the .profile and runs the command you want to run.

To source the .profile in a script or on a command line(assuming you are in the home directory): $ . ./.profile
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

RSH

Hi All, Whenever we are giving rsh localhost date , it give an error "Permission Denied". RHEL 6 is the version, and we're logging in as "root". in .rhosts file I have mentioned all the details, and enabled rsh,rsync,rexec,rlogin in /etc/xinetd.d/ file Please suggest. Reg, Muzaffar (7 Replies)
Discussion started by: muzaffar.k
7 Replies

2. Infrastructure Monitoring

trap in etc/profile and user .profile

Hello I really wonder what's trap in etc/profile and in each user .profile. I try to google for it but I think I have no luck. Mostly hit is SNMP traps which I think it is not the same thing. I want to know ... 1. What's a "trap 2 3" means and are there any other value I can set... (4 Replies)
Discussion started by: Smith
4 Replies

3. Red Hat

Rsh

Hi, I issue : rsh ****.16.0.151 -l root ls -l /tmp and I receive : connect to address ***.16.0.151: Connection refused Trying krb4 rsh... In hosts file of remote (***.16.0.151) I have : ***.16.0.202 root Can you help me ? Thank you. (0 Replies)
Discussion started by: big123456
0 Replies

4. UNIX for Dummies Questions & Answers

difference between /etc/profile and .profile?

What is the difference between /etc/profile and .profile? (5 Replies)
Discussion started by: gehlnar
5 Replies

5. UNIX for Advanced & Expert Users

Rsh

Hi All, I want to execute a command from my Windows machine to Linux machine using RSH only d:> rsh <Linux machine add> -l <user_name> pwd>dir in linux machine users home directory in .rhosts file I entered the windows machine IP address and user name. In linux etc/hosts.equiv file I... (1 Reply)
Discussion started by: sarwan
1 Replies

6. Linux

Help in RSH

Hi All, I want to execute a command from my Windows machine to Linux machine. d:> rsh <Linux machine add> -l <user_name> pwd>dir in linux machine users home directory in .rhosts file I entered the windows machine IP address and user name. In linux etc/hosts.equiv file I entered the... (1 Reply)
Discussion started by: sarwan
1 Replies

7. UNIX for Dummies Questions & Answers

Where can I read about the difference between "..profile" and ".profile"

Hi I know from reading O Riley's Classic Shell Scripting' that the .profile file is " the shells configuration file" but I am unable to find a reference to what "..profile" means. I have searched on the net, Sams Teach Yourself Unix, Unix Visual Quickstart Guide and Linux in a Nutshell. I have... (2 Replies)
Discussion started by: zorrokan
2 Replies

8. SCO

Difference between .profile and .~/.profile

what is the difference between these two lines, if we use it in korn shell script: .profile .~/.profile (3 Replies)
Discussion started by: maneesh mehta
3 Replies

9. UNIX for Dummies Questions & Answers

changed .profile but didnt ./.profile, yet reflected changes

hi , i added ls -F to .profile. and i need to do ./.profile for the effect to take effect BUT i didnt and YET the next day when i came to work and log in, the changes took effect. i am on aix. please explain.. thanks (4 Replies)
Discussion started by: yls177
4 Replies

10. Shell Programming and Scripting

help with rsh

I am trying to run a Perl script using rsh. I need to be able to capture the return code value, so the calling script can handle failures properly. I cannot modify the Perl script I need to run because we use it for all of our servers. Does anyone have a suggestion? (1 Reply)
Discussion started by: kscase
1 Replies
Login or Register to Ask a Question