0

On the server side : ( @ip for example 10.0.0.3 )

Consider this simple script named script.sh : ( /home/user/script.sh )

#!/bin/bash
echo good

Let's create new service named script.sh under xinetd to run script above : ( /etc/xinetd.d/script.sh )

service script.sh                       # Name from /etc/services;
{
        server = /home/user/script.sh          # The service executable
        server_args = ANY_ARGS_HERE        # Any arguments; omit if none
        user = USER                        # Run the service as this user
        socket_type = TYPE                 # stream, dgram, raw, or seqpacket
        wait = nO                      # yes = single-threaded, no = multithreaded
}

Then, let's add this service to /etc/services :

script.sh    3376/tcp 

Finally restarting xinetd : service xinetd restart

On the client side :

Now I want to run script.sh remotely using script.sh service located on the server . it might be something like this : script.sh 10.0.0.3 3376/tcp

Here comes my question :

what are the configurations to do on the client side in order to execute this script on the server and get results on the client ?

1

You connect to the port that you've defined in /etc/services and /etc/xinetd. So either of these commands could work for you, assuming 10.0.0.3 is the remote server hosting the script.sh service:

nc 10.0.0.3 3376
telnet 10.0.0.3 3376

If you're running a firewall on the remote server you will need to punch a hole through it for incoming sessions on 3376/tcp. Without knowing which firewall you're running it's not sensible to offer a solution for that. (If you want to update your Question then I or someone else can offer a fix.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.