Posted 06 April 2015 - 07:33 PM
I found that implementing a new protocol for each new program, on each new computer in my network was way too much work, so I decided to implement ssh, which is basically remote access to a computer as if you where sitting in front of it.
In my implementation I felt that remembering IDs was a tedious task, so I made a quick dns implementation too.
dns is not required for ssh to work, but handy for organizing lots of computers.
Files:
dns_client: pastebin get ZuDbvKXA dns
ssh_server: pastebin get GKUdv2Dt server
ssh_exit: pastebin get Lbu2cVtu exit
ssh_client: pastebin get FnBb0vFE ssh
open: pastebin get bqDQPkGx open
close: pastebin get 77hUjE85 close
Setup:
The dns server will automatically connect to the rednet, and will assume that a [wireless] modem is placed on the top. It also requires a file named db, containing "{}" without the quotes.
The ssh server will not connect to the rednet automatically, and whenever a session is closed it will reboot. In order to close a ssh session the server will need the ssh_exit file. Because the ssh server reboots when a session is closed, it is recommended that you create a startup file containing something along the lines of.
In order to lookup the ssh server on the dns server, you will also need the dns_client file, and should run:
The client will at least need the ssh_client file, and the dns_client file too if you want to use the dns server.
The "open" and "close" files are utility programs that you can use to open/close a rednet connection, which is useful for a pocket computer. To open rednet on a pocket computer you can use:
Usage:
To connect to a ssh server, simply type ssh <id>, where id is the number next to the hostname from the previous command. You can also get this number by running the "id" program on the ssh server computer. If done successfully, you should be greeted by this prompt:
Note that you do not need the dns server in order to access the ssh server, but you will not be able to get the hosname list with the "ssh" command.
This is my first computercraft project and also my first post on this forum, so please bear with me. Any feedback, bug reports and requests are greatly appreciated, and I will continue to support this thing for at least a few months. :)/>
In my implementation I felt that remembering IDs was a tedious task, so I made a quick dns implementation too.
dns is not required for ssh to work, but handy for organizing lots of computers.
Files:
Spoiler
dns_server: pastebin get Fr66zLSn serverdns_client: pastebin get ZuDbvKXA dns
ssh_server: pastebin get GKUdv2Dt server
ssh_exit: pastebin get Lbu2cVtu exit
ssh_client: pastebin get FnBb0vFE ssh
open: pastebin get bqDQPkGx open
close: pastebin get 77hUjE85 close
Setup:
Spoiler
You need at least 2 computers of any type with rednet access - 3 if you want dns.The dns server will automatically connect to the rednet, and will assume that a [wireless] modem is placed on the top. It also requires a file named db, containing "{}" without the quotes.
The ssh server will not connect to the rednet automatically, and whenever a session is closed it will reboot. In order to close a ssh session the server will need the ssh_exit file. Because the ssh server reboots when a session is closed, it is recommended that you create a startup file containing something along the lines of.
rednet.open("top")
shell.run("server")
In order to lookup the ssh server on the dns server, you will also need the dns_client file, and should run:
dns register livingroom
if you want the computer to be named "livingroom". Note that the computer have to be connected to the rednet to run this command successfully.The client will at least need the ssh_client file, and the dns_client file too if you want to use the dns server.
The "open" and "close" files are utility programs that you can use to open/close a rednet connection, which is useful for a pocket computer. To open rednet on a pocket computer you can use:
open back
Usage:
Spoiler
Both the ssh server and the dns server should be running (ignore the latter if you don't use dns). If you use dns, you can run "ssh" (on the ssh client) to get a list of all registered ssh servers with their id's and hostnames.To connect to a ssh server, simply type ssh <id>, where id is the number next to the hostname from the previous command. You can also get this number by running the "id" program on the ssh server computer. If done successfully, you should be greeted by this prompt:
> ssh 3
SSH by BlackCap
ssh>
note that you now have a "ssh" prompt rather than a normal prompt, indicating that you are now connected to another machine. You may now use any program on the computer, as if you where sitting in front of it:
>open back
>ssh
3 - server
> id
This is computer #9
> ssh 3
SSH by BlackCap
ssh> id
This is computer #3
This computer is labelled "server"
ssh>
to disconnect from the server, run the exit program on the server:
ssh> exit
Session closed
>
if you simply terminate the program the server will continue to believe that you are connected, and you will be unable to reconnect.Note that you do not need the dns server in order to access the ssh server, but you will not be able to get the hosname list with the "ssh" command.
This is my first computercraft project and also my first post on this forum, so please bear with me. Any feedback, bug reports and requests are greatly appreciated, and I will continue to support this thing for at least a few months. :)/>
Edited on 06 April 2015 - 08:20 PM