1847218 Members
3816 Online
110263 Solutions
New Discussion

Re: rexec command

 
Pawan_1
Frequent Advisor

rexec command

Is there a way to pass the password string to the rexec command, Since the rexec prompts for the password.
11 REPLIES 11
RAC_1
Honored Contributor

Re: rexec command

All r commands(rlogin , remsh, rexec etc) works on .rhosts file.

Set .rhosts file. Else it will ask for the password.

Anil
There is no substitute to HARDWORK
Pawan_1
Frequent Advisor

Re: rexec command

Well wanted to pass the password to the string, rather than adding to .rhosts and hosts.equiv files.
RAC_1
Honored Contributor

Re: rexec command

You cant. rexec is nor designed that way.

R commands are not secure, us ssh instead and ssh can be set for password less authentication.

Anil
There is no substitute to HARDWORK
Sundar_7
Honored Contributor

Re: rexec command

Hi,

You can create a .netrc file with the login name and password. rxec will use that information

# vi ~root/.rhosts
machine login root password password123
#

# rexec -l root date

-- Sundar
Learn What to do ,How to do and more importantly When to do ?
Pawan_1
Frequent Advisor

Re: rexec command

Thanks Anil. Hope this will clarify what we need

rexec alaska12 -l pawan -n ll /etc < {pass the password } to this string.

In this way we are not authenticating without password.
RAC_1
Honored Contributor

Re: rexec command

As told earlier, this will not work.
rexec alaska12 -l pawan -n ll /etc < {pass the password }

rexec is not designed to work that way.

Use ssh instead.

Anil
There is no substitute to HARDWORK
Pawan_1
Frequent Advisor

Re: rexec command

Well thanks and will foucs on ssh.
Sundar_7
Honored Contributor

Re: rexec command

Did you try using .netrc ?
Learn What to do ,How to do and more importantly When to do ?
Pawan_1
Frequent Advisor

Re: rexec command

Yes and it does work. Was trying to avoid using ".netrc" as multiple users will be executing the commands at the same time and this will conflict with .netrc
Sundar_7
Honored Contributor

Re: rexec command

.netrc is specific to a user and it should be present in the user's home directory with the permissions such that only the owner can read/write to the file.

say if user1 has .netrc and user2 doesnt then if user2 executes rexec command, he has to supply the password and the user1's .netrc WILL not be referred for the rexec commands user2 executes.

So there is no scope for conflicts.
Learn What to do ,How to do and more importantly When to do ?
Pawan_1
Frequent Advisor

Re: rexec command

Thanks for helping in this one and will use ssh route, which is more secure.