Originally Posted by jpollard
Depends on what you want to do...
ssh -t host1 ssh host2 <optional command>
Forwarding X based utilities works just fine - though you might have to add a -X to the ssh option list.
BTW, the -t in the first ssh is to force a terminal so that the terminal obtained on host2 has appropriate translations.
Thanks for your suggestion, Actually I am really not yet sure and confused if this would work. So I have been making situations the hard way (sorry for that)
host1 = windows box that will run the script as "user1" using a tool via click button
button from windows tool will run the script = plink.exe -ssh -pw <password> -noagent user1@host2 "/opt/user2/test_script.sh host3"
host2 = required going to host3 "user1" is already there
host3 = where the script resides owned by user2(/opt/user2/test_script.sh)
I am able to run the script from host3 1st it is required to login as "user1" then sudo su to "user2" to run the script
command in host3 as user1:
* sudo su - user2
so I tried this:
* from host3 I made this file = /etc/sudoers.d/testuser
Cmnd_Alias TESTSCRIPT = /opt/user2/test_script.sh
%testusers ALL=(user2) NOPASSWD: TESTSCRIPT
note: included on %testusers group is user1
* from host2 I tried to 1st to run the script suing the command below:
/usr/bin/ssh host3 "/usr/bin/sudo /opt/user2/test_script.sh"
but what I got is this error = "sudo: sorry, you must have a tty to run sudo"
please advise. thanks in advance