Operating System - HP-UX
1827893 Members
1782 Online
109969 Solutions
New Discussion

Re: Sending commands via ssh argument

 
SOLVED
Go to solution
Mark Castagna
Occasional Visitor

Sending commands via ssh argument

Hello All,
I can use ssh to send a telnet command to a remote host and have the login prompt returned.

Example,
From hostA as any user, ssh -l userA hostB telnet hostC after entering the password for userA I get a login prompt from hostC.

Preliminarily, I've tried rksh, removing /etc/PATH but, it seems to me that ssh only authenticates against a user (etc/passwd) but, doesn't use any shell environment. I'm perplexed.

Thanks,
Mark Castagna
4 REPLIES 4
Steven E. Protter
Exalted Contributor

Re: Sending commands via ssh argument

Two things:

1) Try pure ssh. ssh replaces telnet. you can send ssh commands in the command string ssh root@disk.itool.com "./etc/profile;ssh sys2.itool.com $commands"

2) Set up the ssh for password free authentication by exchanging public keys. See the doc I'm attaching.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Charlie Rubeor
Frequent Advisor

Re: Sending commands via ssh argument

Could you provide a little more info on what you are trying to accomplish?

The login prompt from hostC is a result of the telnet command. Sending the telnet command via ssh will encrypt the connection between hostA and hostB, but the connection between hostB and hostC will remain clear text. If you are trying to eliminate the login and password prompts, then use ssh on all three hosts, along with the public keys.

AFAIK, ssh does require a valid user and will use the shell as listed in /etc/passwd. I would ssh to hostB, verify that the shell environment is correct on hostB. Then ssh/telnet to hostC and verify the shell environment on hostC.
Mark Castagna
Occasional Visitor

Re: Sending commands via ssh argument

Thanks for the document. That will answer some other questions I have.

I probably didn't make myself completely clear. I don't want unscrupulous users to be able to use ssh to access telnet (or any other command).
Thanks again,
Mark
Charlie Rubeor
Frequent Advisor
Solution

Re: Sending commands via ssh argument

Thank you, that makes much more sense.

You should be able to configure sudo to limit your users to specific commands, as well as eliminating the ability to pass arguments. i.e., "sudo ssh hostA" would be ok, but "sudo ssh hostA ls" would not be ok.

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/sudo-1.6.7p5/