Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating directories remotely

Status
Not open for further replies.

blx

MIS
Oct 9, 2002
23
GB
Hi All,
Is there a way that I can create a directory on a remote machine from a bash command?

Thanks in Advance

 
Sorry, but in my environment rsh is not supported. How would I do this from a script?

 
You want to be able to magically create a directory
or how would you connect in the first place?

I have an awk script that sets up a server that can do
what you want but it requires gawk 3.1..
Code:
#use at your own risk
    function interpreter(cmd,auth, list) {
       if (auth && cmd) {
         print "Sending", cmd
         while ((cmd | getline) > 0) {
            list = length(list) < 1 ? $0&quot;\n&quot; : list&quot;\n&quot;$0
         }
      }
      close(cmd)
      return list
    }


    BEGIN {
        passwd = &quot;bogus&quot;
        socket = &quot;/inet/tcp/2300/0/0&quot;

        while (1) { 
           while ((socket |& getline) > 0) {
               if (!auth) {
                 printf &quot;Password: &quot; |& socket
                    if ((socket |& getline) > 0 && $0 == passwd) {
                      auth = 1
                    } else {
                      print &quot;Sorry, wrong password: &quot;,$0 |& socket
                      auth = 0
                    }
              }
              print &quot;AwkRemote Command Shell--> #&quot;, cnt |& socket
              res = interpreter($0,auth)
              print res |& socket
           }
           close(socket)
           auth = 0
           socket |& getline
       }
    }

For the client you could use netcat, any telnet client, etc..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top