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?
Last edited by GenericLinuxUser; 03-27-2023 at 08:15 AM.
|