LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 02-17-2008, 08:25 PM   #1
Stevie-B-242
LQ Newbie
 
Registered: Oct 2005
Posts: 9

Rep: Reputation: 0
Simple rsh issue


...once again, I'm obviously a newbie with a question like this but here's a chance to solve a simple issue and in the process show that you are smarter than me. %-)

I'm trying to configure and enable rsh on a node in a small Linux cluster (RHEL 5).

I've modified
/etc/xinetd.d/rsh
/etc/xinetd.d/rlogin
/etc/xinetd.d/rexec
to set "disable = no"

added lines for rsh and rlogin to /etc/securetty

and then issued a #services xinetd restart

but when I try to test rsh locally on the node, I get the following:

[root@C1-N1 ~]# rsh localhost
connect to address 127.0.0.1 port 543: Connection refused
Trying krb4 rlogin...
connect to address 127.0.0.1 port 543: Connection refused
trying normal rlogin (/usr/bin/rlogin)
Password:

I imagine I've made a really simple mistake somewhere along the way...do you know where I've gone wrong?

Thanks in advance for any help you can offer on this!

--Steve
 
Old 02-17-2008, 08:36 PM   #2
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Quote:
I'm trying to configure and enable rsh
... do not use rsh, use ssh.

http://www.fnal.gov/docs/strongauth/encryptconn.html
 
Old 02-17-2008, 08:45 PM   #3
Stevie-B-242
LQ Newbie
 
Registered: Oct 2005
Posts: 9

Original Poster
Rep: Reputation: 0
...thanks for the quick reply Simon.

I know that SSH is vastly preferred in most instances to rsh because SSH is secure and rsh is not.

However, as I mentioned in a different thread today, this is for a small lab cluster which is completely isolated from the outside world.

...In this instance, I'm not looking for the most secure implementation... I just desperately need something that I can get working right now.

Thanks.
--Steve

Last edited by Stevie-B-242; 02-17-2008 at 08:47 PM.
 
Old 02-17-2008, 08:54 PM   #4
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
ssh is also easier/easier to set up.
(I think I replied to your other thread... lost track...)
http://suso.org/docs/shell/ssh.sdf
 
Old 02-18-2008, 06:00 PM   #5
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,979
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
You need to have a .rhosts in the home directory of the user you are trying to rsh as....

~/.rhosts

You need to put the IP address (or if you have DNS set up the fqdn) in the file.

And Simon Bridge is right...don't use rsh...

-C
 
Old 09-24-2009, 07:11 AM   #6
IanVaughan
Member
 
Registered: Jun 2009
Location: Brighton, UK
Posts: 50

Rep: Reputation: 16
Yes SSH might be better than RSH, but rsh can allow commands to be sent.
As I want to script some actions from a remote host that are to be performed on the target, rsh is better.
 
Old 09-24-2009, 07:16 AM   #7
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
What's stopping you from sending those commands with SSH?
Code:
ssh user@remotehost "date > didthiswork"
I just tested this and it successfully created a file called didthiswork on the remote host.
 
Old 09-24-2009, 09:27 AM   #8
IanVaughan
Member
 
Registered: Jun 2009
Location: Brighton, UK
Posts: 50

Rep: Reputation: 16
Yep, basic commands work, but what about shell type/env setup?
SSH with and without command gives different results? env is different?

works as expected
Code:
[a ~]$ ssh 172.24.40.100
Last login: Mon Jan  1 06:07:24 2001 from 172.24.41.78
[b ~]# /path/script.sh
gives me error consistent with env setup
Code:
[a ~]$ ssh 172.24.40.100 /path/script.sh
Which implies the latter is running the script.sh on host a, when I want to
'launch' in from a, and 'run' it on b!?
 
Old 09-24-2009, 09:32 AM   #9
IanVaughan
Member
 
Registered: Jun 2009
Location: Brighton, UK
Posts: 50

Rep: Reputation: 16
Redirecting my previous question to here as more on subject.
 
Old 09-24-2009, 09:47 AM   #10
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
How about sourcing the profile before running the command?
Code:
ssh user@host "source /etc/profile; /path/script.sh"
You might find it best to change that to ~/.bash_profile, ~/.bashrc, or whatever.
 
Old 09-24-2009, 10:08 AM   #11
IanVaughan
Member
 
Registered: Jun 2009
Location: Brighton, UK
Posts: 50

Rep: Reputation: 16
Quote:
Originally Posted by pwc101 View Post
How about sourcing the profile before running the command?
Code:
ssh user@host "source /etc/profile; /path/script.sh"
You might find it best to change that to ~/.bash_profile, ~/.bashrc, or whatever.
Code:
ssh 172.24.40.100 "source /root/.bash_profile; /path/script.sh"
Worked! You ppl are great! Cheers.
 
Old 09-24-2010, 09:19 AM   #12
felton57
Member
 
Registered: Aug 2007
Posts: 35

Rep: Reputation: 15
My problem is the same as above. Here is my dilemma:

I want to shutdown a number of computers in my lab. Hostnames are jmud1, jmud2, jmud3 and jmud4 .... jmud20.

Current script or command used:

#!/bin/csh

foreach num (`/root/tools/machines`)
rsh jmud{num} /sbin/shutdown -hy 0 &

end

#End of Script

How do I replace is with ssh or something useable in RHEL5?
 
Old 09-24-2010, 10:15 AM   #13
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Without knowing what /root/tools/machines does or contains, I'll assume it has the hostnames on separate lines in it. If so, then you could try:
Code:
#!/bin/bash

# Iterate through each remote host in the file /root/tools/machines 
while read rhost; do
    ssh root@$rhost "/sbin/shutdown -h now"
done < /root/tools/machines
You'll have to ssh in as root (often considered a bad idea), or set up sudo to allow a different, less privileged user to execute /sbin/shutdown.

Edit: You can also specify users who are allowed to shutdown the machine in /etc/shutdown.allow without the need to set up sudo. You do need to pass -a to the shutdown command, though. See man shutdown for more info.

Last edited by pwc101; 09-24-2010 at 10:22 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple (?) resolution issue. Zombie13 Fedora 5 10-05-2007 09:37 AM
permission denied using rsh (security not an issue) Singist Linux - Networking 1 04-04-2006 02:22 PM
RSH: remuser too long error when rsh is executed from IIS dev33445 Programming 0 08-29-2005 09:34 AM
rsh issue in AIX boxes oosii AIX 2 07-21-2005 07:34 AM
weird issue with RSH over a network, anyone seen this? govtlinux Red Hat 0 11-12-2004 09:39 AM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 02:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration