rsh runs perfectly in normal user but not in root, very strange, why?
Solution 1
The first example tries to login as root
on the system and run pwd
while the second example logins via service
and runs pwd
.
It is likely that your configuration does either not allow logins as root or from root at localhost.
To debug it further you can try to run rsh -l service localhost pwd
and see if it works. Please also have a look at Why can't I use strace with rsh? which explains another possible issue.
Solution 2
Erradicate rsh
immediately. It is a huge security risk. No, "this is just an internal network, there won't be any evil chinese hackers" is totally irrelevant, attacks are either automated (to recruit for botnets) or targeted, and the second ones are (depending on the statistics you want to believe) initiated by internal users in 80 to 95% of the cases.
Use ssh
, it gives almost the same benefits but is much more secure. Yes, it is a bit harder to set up, but not that much.
Related videos on Youtube
devsda
Updated on September 18, 2022Comments
-
devsda almost 2 years
When I run command,
rsh localhost pwd
as a rootIt shows below output.
connect to address 127.0.0.1 port 544: Connection refused Trying krb4 rsh... connect to address 127.0.0.1 port 544: Connection refused trying normal rsh (/usr/bin/rsh) rcmd: socket: Permission denied
When I run the same command from normal user named
service
. Then it shows below output.connect to address 127.0.0.1 port 544: Connection refused Trying krb4 rsh... connect to address 127.0.0.1 port 544: Connection refused trying normal rsh (/usr/bin/rsh) /home/service
Why this behavior happening?
-
devsda over 11 yearsWhen I run
rsh -l service localhost pwd
from root, it shows the same error. , .i.e.,Permission Denied
-
sunnysideup over 11 years@jhamb then have a look at the
rhosts
//etc/hosts.equiv
file of your service user and add an entry for the root user... -
devsda over 11 years/etc/hosts.equiv only one line i.e.,
+ service
. Now I added one more line+ root
. Then I reboot, but when I runrsh localhost pwd
from root , but I shows againPermission Denied
. What can I do now ? -
sunnysideup over 11 years@jhamb use
rsh -l service localhost
and read the documentation of rsh to understand the issues. -
Deer Hunter over 11 yearsWould have upvoted a thousand times if I could.
-
devsda over 11 yearsIn root,
rsh -l service localhost pwd
works, butrsh localhost pwd
not works. -
devsda over 11 yearsCan you give answer of above comment?