1820882 Members
3558 Online
109628 Solutions
New Discussion юеВ

remsh host1 passwd user1

 
SOLVED
Go to solution
jerry1
Super Advisor

remsh host1 passwd user1

Why does "remsh host1 passwd user1" not work?

# remsh host1 passwd user1

#


Then nothing. ???
8 REPLIES 8
Steven Schweda
Honored Contributor
Solution

Re: remsh host1 passwd user1

Perhaps because "passwd" expects to interact
with the user, and it can't do that in this
context.

"man remsh":

[...] remsh cannot be
used to run commands that require a terminal interface (such as vi) or
commands that read their standard error (such as more). In such
cases, use rlogin or telnet instead (see rlogin(1) and telnet(1)).
mobidyc
Trusted Contributor

Re: remsh host1 passwd user1

Hello,

because according to the man page, the command is:
remsh hostname [ -n ] [ -l username ] command

so you can do:
# remsh host1 -l user1 "uname -a"

on host1, the home directory of user1 must contain a .rhosts file, this file can have these informations:
remote_host user1

you must also verify that the daemon is running:
# ps -ef |grep remsh |grep -v grep
root 11056 2395 0 Mar 12 ? 0:00 remshd

you can read remsh(1) for more informations.

Regards,
Cedrick Gaillard
Best regards, Cedrick Gaillard
Steven Schweda
Honored Contributor

Re: remsh host1 passwd user1

It's easier to turn off the echo on /dev/tty
than it is on stdin?
Steven Schweda
Honored Contributor

Re: remsh host1 passwd user1

mobidyc:

It may be confusing at first, but:

remsh = remsh
hostname = host1
[ -n ] (not used)
[ -l username ] (not used)
command = passwd user1

It's the "passwd" command which is not doing
what he expected, not "remsh".

"passwd user1" could have been quoted to make
it clearer.
jerry1
Super Advisor

Re: remsh host1 passwd user1

Can't use rlogin to pass a command.

Basically, I need to setup something
for the helpdesk to run remote password
changes on old 10.20 boxes that are not
NIS bound. I remember doing something
like this in the past but it was with
Solaris 2.6.

I may have to use "expect" or if someone
has a perl script that would do the same.

mobidyc
Trusted Contributor

Re: remsh host1 passwd user1

Sorry,

i use to quote my commands after a remsh/rsh, i though passwd was an arguments to remsh 0o.

you can't launch an interactive command from rsh/remsh.

you can crypt your passwd and modify the /etc/paswd file for changing password on multiple servers, and you can do it more secure by using ssh.

Regards,
Cedrick Gaillard
Best regards, Cedrick Gaillard
Steven Schweda
Honored Contributor

Re: remsh host1 passwd user1

> Basically, I need to setup something [...]

Frequently, it helps to provide the actual
problem which you are trying to solve, rather
than asking how to debug the implementation
of a proposed solution to that problem.

In this case, I can tell you why your attempt
failed, but not how to do what you want. I'd
be a little amazed if "expect" could do the
job either, but I've been amazed before.
Steven Schweda
Honored Contributor

Re: remsh host1 passwd user1

A Google search for things like:
passwd expect script
seems to turn up more than a few examples, so
it must be a popular technique, contrary to
my initial expectations. Trust no one, I
always say. Especially me.