Is there anyway to run a remote command via ssh as if it's run from the local server?
Hi,
I am working on setting up an LDAP connection on a server. On the server I want to use ldapsearch for testing but it's not installed. I do have access to ldapsearch installed on another server. However, the AD server is only seen from the server that does not have ldapsearch installed. I've asked our sysadmins to install ldapsearch on the needed server but there's a bureaucratic hold up and I'm trying to see if I can somehow run the remote command as if I'm on the server and just get this done. In other words, I can see an AD server (XXX) from server YYY myuser@YYY: ping -c 1 XXX PING XXX (xxx.xxx.xxx.xxx) 56(84) bytes of data. 64 bytes from XXX (xxx.xxx.xxx.xxx): icmp_seq=1 ttl=121 time=32.6 ms --- XXX ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 32ms I can't from ZZZ myuser@ZZZ: ping -c 1 XXX ping: XXX: Name or service not known I can run ldapsearch from server ZZZ on server YYY via ssh myuser@YYY: ssh myuser@ZZZ ldapsearch -x -h XXX -p 389 -D "CN=myuser,CN=users,DC=example,DC=Com" -W -b "DC=example,DC=Com" cn=myuser But this of course returns "Can't contact LDAP server" because ZZZ does not know of XXX. Is there anyway to run a remote command via ssh as if it's run from the local server? |
You could try a reverse tunnel to forward the LDAP port and then connect to the LDAP port on the address for localhost on the remote system.
|
Thanks Turbocapitalist, reverse tunneling seems promising, I'll look into that
|
you just need to run the command on ZZZ: ssh myuser@YYY ldapsearch ....
|
pan64, if I do that I get "bash: ldapsearch: command not found" because ldapsearch is not installed on YYY
|
Also copy the certs for making life a bit easier
https://www.thegeekstuff.com/2008/11...n-ssh-copy-id/ |
All times are GMT -5. The time now is 10:07 AM. |