[gameprogrammer] Re: Not game dev related but need some urgent help

  • From: Jake Briggs <jakbri@xxxxxxxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Fri, 07 May 2010 10:48:57 +1200

Instead of a username and password, you should use keys for passwordless logins. You could use http://sshwindows.sourceforge.net/ and do something like :


ssh user@hostname "scriptName.sh -a argument -b argument2" > output.txt

The 2nd argument to ssh is the command to run on the machine, and the ">" redirects the output to the file output.txt.

Here is how to generate keys : http://nosheep.net/story/password-less-ssh-login/

Here is an example. My work machine is called osama, my home machine's URL is obscured (its name is beastie), but there are keys on each :

jakbri@osama:/data1/48hrs$ ssh jake@xxxxxxxxxxxxxx "ls"
beastie-bttv.txt
debian-multimedia-keyring_2008.10.16_all.deb
Desktop
linux-wbfs-manager
Mail
Music
osama-bttv.txt
Pictures
play.sql
plucker
Projects
sdl
sync-from-ipod.sh
sync-ipod.sh
temp
Videos
jakbri@osama:/data1/48hrs$

This example ssh's to the machine at urlto.jake.com, using the username jake, no password since the keys take care of that. It runs the command "ls" which lists the contents of a directory and the results go to the terminal on osama where I ran the command.

Another example, the command ls -ls *.txt lists the contents of the directory with filenames that end in .txt and the -l means in a list and the h in -lh means human readable file sizes :

jakbri@osama:/data1/48hrs$ ssh jake@xxxxxxxxxxxxxx "ls -lh *.txt"
-rw-r--r-- 1 jake jake  814 2009-07-26 13:15 beastie-bttv.txt
-rw-r--r-- 1 jake jake 1.1K 2009-07-26 13:07 osama-bttv.txt
jakbri@osama:/data1/48hrs$

and another, where I redirect the stdout to a file, then show the file  :

jakbri@osama:/data1/48hrs$ ssh jake@xxxxxxxxxxxxxx "ls -lh *.txt" > list.txt
jakbri@osama:/data1/48hrs$ cat list.txt
-rw-r--r-- 1 jake jake  814 2009-07-26 13:15 beastie-bttv.txt
-rw-r--r-- 1 jake jake 1.1K 2009-07-26 13:07 osama-bttv.txt
jakbri@osama:/data1/48hrs$

I think you could do something similar with plink - the putty command line.

Jake



On 07/05/10 04:54, ®£$ǖ"v@M$Ħ ¢© $. wrote:
Glad to hear it's on topic  :).

I need to connect to the linux box to execute a program from a specific
directory, with a known username and password. Also, i need to gather
data from the application and display it back in my original
program(located on my windows machine)

Thanks for your time :)

On Thu, May 6, 2010 at 10:16 PM, Alan Wolfe <alan.wolfe@xxxxxxxxx
<mailto:alan.wolfe@xxxxxxxxx>> wrote:

    This is somewhat on topic since networked games sometimes run linux
    servers and we all dev on windows (pretty much).

    What do you need to connect for?  IE what task are you trying to
    preform?

    Depending on the answer to that question, I have a couple different
    ways you could achieve your goal (:

    2010/5/6 ®£$ǖ"v@M$Ħ ¢© $. <theamericansushi@xxxxxxxxx
    <mailto:theamericansushi@xxxxxxxxx>>

        Sorry guys this isn't game development but i've already
        exhausted all my resources (google :P ).
        Okay, so here's a overview. I need remotely connect to a linux
        based machine from my windows machine via vb.net <http://vb.net>
        I've already tried PuTTy but that requires me to enter the
        username and password after establishing the connection. Maybe
        if there's a way i can hardcode the username and password so
        that it auto logins on opening?
        I really need help doing this so any form of help is really
        appreciated.
        BTW pls don't get angry im on the wrong list, you guys were the
        best help i got before for something else so i thought i'd give
        this a shot

        Thanks,
        Suvamsh




--

Jacob Briggs
Systems Engineer

Core Technology Limited
Level 1, NZX Centre
11 Cable Street
Wellington
Phone +64 4 801 2250

--

Private Object doAnythingConceivable(String whatToDo, Object whatToDoItWith) { .....


---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: