How to ssh to this machine?

pitupepito2000

Golden Member
Aug 2, 2002
1,181
0
0
Hi,

Right now I am at school, and there's a machine here that I have installed linux in. I would like to remotely control this machine, but how can I set ssh. I have heard about tunnels, can they be used in this situation.

Please help me,
pitupepito
 

pitupepito2000

Golden Member
Aug 2, 2002
1,181
0
0
it is in a computer room in a classroom. It is part of a subnet.

Windows 98 IP Configuration

Host Name . . . . . . . . . : B103-
DNS Servers . . . . . . . . : 192.168.100.250
192.168.100.251
Node Type . . . . . . . . . : Broadcast
NetBIOS Scope ID. . . . . . :
IP Routing Enabled. . . . . : No
WINS Proxy Enabled. . . . . : No
NetBIOS Resolution Uses DNS : No

0 Ethernet adapter :

Description . . . . . . . . : 3Com 3C90x Ethernet Adapter
Physical Address. . . . . . : 00-C0-4F-48-86-A4
DHCP Enabled. . . . . . . . : Yes
IP Address. . . . . . . . . : 192.168.160.140
Subnet Mask . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . : 192.168.160.1
DHCP Server . . . . . . . . : 192.168.160.1
Primary WINS Server . . . . :
Secondary WINS Server . . . :


Thanks for the help,
pitupepito2000
 

cleverhandle

Diamond Member
Dec 17, 2001
3,566
3
81
Are you trying to connect from a machine on the same network? Can you ping the target machine from the would-be controller?
 

Spyro

Diamond Member
Dec 4, 2001
3,366
0
0
I'm no guru, but it seems that all of your machines addresses are on the 192.168.*.* ip range, which means that that machine is on a private network, and you won't be able to access it from the net.
 

pitupepito2000

Golden Member
Aug 2, 2002
1,181
0
0
Is there anything that I can do to access this machine? This machine is one that I can just play around with Linux, but at home I only have one machine to play linux with, and I don't want to mess it up because I am not the only user of that Linux box.

thanks for the input,
pitupepito
 

mjquilly

Golden Member
Jun 12, 2000
1,692
0
76
If you can access a machine visible to the internet that your target machine can see - that would work. You'd ssh into the machine on the internet, then from there ssh into the target machine.
 

skyking

Lifer
Nov 21, 2001
22,774
5,935
146
Originally posted by: mjquilly
If you can access a machine visible to the internet that your target machine can see - that would work. You'd ssh into the machine on the internet, then from there ssh into the target machine.

The only other method is to get the network admin to forward port 22 to that machine, which is just about impossible.
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
There are ways to pierce firewalls. It's not for the faint of heart, basicly it would be considured "hacking" by most layman since it would be activly circumventing firewalls.

It would be best to get permission to do this before hand!!!

There a firewall piercing howto, and probably tunneling (do a search on google, it's easy to find) involving setting up a telnet server, but it should be similar with ssh, plus ssh will be secure, not that it won't be easy to detect for a skilled network admin, but snoops on the internet won't be able to peak in on your session without a quite a bit of effort BEFORE you create the session.

Basicly you need to be root. you set up a ssh session with the remote computer and create a artifical network thru the ssh session, basicly creating a tunnel. Then you setup servers to use that artifical network. And in all it's a bit beyond my meger experiance, but I suppose I could set one up with a week or two of research. :)

Then you would probably just set up a cron task to exicute the a script at a certain time to have the computer ssh into your computer and set up the network. then you would have your network.

The usfullness of this is limited since it would be easier for a network person to port forward 22 to the privately networked machine, but it would be nice for creating virtual private networks (I suppose look into that stuff, too. Now that I think about it) with remote networks, or create a temp. server with out comprimising the firewall or a very secure network.
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
Ah here I found it....

here (fixed it)

Pretty simple I guess, set up a ssh into your home server (you sitting at the computer at school sshing into your home computer, i mean), then setup ppp (point to point) to go over the ssh session, like you would be dialing up using a modem. Now as long as you have that setup, you can go home and access the school computer.

But remember, get permission! Don't want to end up the paper as another 1337 h@X0r that got busted by the ever vigilant FBI or something that stupid, do you?
 

Spyro

Diamond Member
Dec 4, 2001
3,366
0
0
Originally posted by: drag
Ah here I found it....

here (fixed it)

Pretty simple I guess, set up a ssh into your home server (you sitting at the computer at school sshing into your home computer, i mean), then setup ppp (point to point) to go over the ssh session, like you would be dialing up using a modem. Now as long as you have that setup, you can go home and access the school computer.

But remember, get permission! Don't want to end up the paper as another 1337 h@X0r that got busted by the ever vigilant FBI or something that stupid, do you?

Wow that a pretty cool link drag, but I suppose its not for the faint of heart :D
 

pitupepito2000

Golden Member
Aug 2, 2002
1,181
0
0
Hi guys,

Thanks for the info drag. I will see if they give me permission, if they don't I guess I will just have to experiment with my machine at home.

have a good day,
pitupepito :)
 

pitupepito2000

Golden Member
Aug 2, 2002
1,181
0
0
Hi,

I asked permission to my instructor, but he and I can't understand part of the instructions. Could you guys help us out.

Let's assume that your firewall administrator allows transparent TCP connections to some port on some server machine on the other side of the firewall (be it the standard SSH port 22, or an alternate destination port, like the HTTP port 80 or whatever), or that you somehow managed to get some port in one side of the firewall to get redirected to a port on the other side (using httptunnel, mailtunnel, some tunnel over telnet, or whatelse).

thanks for the info,
pitupepito
 

cleverhandle

Diamond Member
Dec 17, 2001
3,566
3
81
Originally posted by: pitupepito2000
Let's assume that your firewall administrator allows transparent TCP connections to some port on some server machine on the other side of the firewall (be it the standard SSH port 22, or an alternate destination port, like the HTTP port 80 or whatever), or that you somehow managed to get some port in one side of the firewall to get redirected to a port on the other side (using httptunnel, mailtunnel, some tunnel over telnet, or whatelse).
See, that's the problem - you don't have "transparent TCP connections to some port on some server machine on the other [internal] side of the firewall." This is not a firewall problem. This is an IP addressing problem. There is no way for a connection, initiated from your home, to find the target machine - regardless of the port or type of packet - because the target machine is not on a public IP.

There are, as far as I see, two solutions -

1) Somewhere above the target machine there is some public IP that is NAT'ing for the hosts on that 192.168 network. If the administrator of that machine is willing to forward a port (either the traditional 22 or any other) to the target, you can proceed basically as described. Just set up sshd to listen on whatever port you're given. This gets around the addressing problem by using the public IP's port instead the target's port. If, for example, you're given port 1200, you would ssh to port 1200 on the public machine, not the target machine. Thus, your target machine would receive incoming port 1200 connections for the entire 192.168 network. There are lots of reasons why this is unlikely to happen, but you can check it out at least.

2) Set up "Reverse Piercing," as described later on in the HOWTO. In this case, you use email to trigger an ssh connection from the target. This gets around the addressing problem because it's no longer your home machine that initiates the connection - the target initiates the connection, and everything else tunnels over that. This involves a lot more work and a root account on the target, but it looks like it should be possible in your situation.

 

drag

Elite Member
Jul 4, 2002
8,708
0
0
I am going to try this out at work and see how well it works. My boss got tired of me bugging her so she let me have this ancient server to show linux off to her.

Basicly You can ssh from the school computer to your home computer, right?

So what it is saying is that you must first establish a ssh session from the school computer and once you have that then you can set up a virtual ppp over the ssh session.

Now when you go home and hopefully the original ssh session with the ppp going over it is still up. Now you should be able to communicate between the 2 computers just like if they were connected thru a dial up connection, you will be able to ftp, ssh, telnet, etc etc all over the original ssh connection (now a tunnel) you made from school.

The hard part would be establishing the original ssh session from home. Once you get the details worked out then you should be able to automate it. Like the guy before me said you could set up the school computer to wait for a certain e-mail and that would trigger the script that will have the school computer ssh into your home computer and then they would negotiate the ppp connection. I thought it would probably be easier to set it on a timer using cron or at. You know have it try to connect your home computer every 15 minutes or just try 3 times at 9 pm in the evening, or so if it isn't already connected.

I am still a bit fuzzy on the details, but hopefully it won't be to hard.


This all depends on your school's computer ability to connect to a server on the "outside" of the firewall. I assume that you can ssh from the school computer into your home computer, just not the other way around, is that correct? Basicly all it realy is is to get the school computer to ssh into your home computer, then setup a virtual network connection using ppp over the original ssh connection, Once you get the virtuall ppp thing going either computer can reach the other thru that, just as long as you have your original ssh connection is good.
 

Need4Speed

Diamond Member
Dec 27, 1999
5,383
0
0
"So what it is saying is that you must first establish a ssh session from the school computer and once you have that then you can set up a virtual ppp over the ssh session."

bingo
 

Bremen

Senior member
Mar 22, 2001
658
0
0
Just to give you another possibility. But can you connect to the school servers at home? When I was in college we had sun servers that all students had shell access to (for email, etc). So I could ssh into copland (one of the servers) and then ssh to my machine (we actually had a class B network, so I could just ssh to my machine anyway...)
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
Alright I got it all figured out :)

Ok I did all this while sitting at the computer behind the firewall. My home computer is just sitting there all innocent-like and has the mythical ip address of 123.123.123.123... Just for s**ts and giggles the computer I am sitting at (which is behind the stinken firewall) has the private address of 192.168.0.5. But this is unimportant. The following ain't the best way since I will be using root accounts, but it works.

Ok here I am at the bash prompt.

1st step: become root.

2nd: goto the /root/.ssh/ directory, if .ssh/ is missing, create it.

3. ssh from here to my home computer and and login as root. (which normally shouldn't be allowed, but right now it is ;) ).

4. change to /root/.ssh on the remote(home) machine.

5. Now here is the fun part, we are gonna make a public/private keycode so we don't have to issue a password to use ssh no more. The command is:

root@home> ssh-keygen -t rsa

pick the defaults names (id_rsa) and don't put any keywords or anything, just leave the passphrase blank. That should generate 2 files. id_rsa, and id_rsa.pub

6. now we make the authorized key file by using the "id_rsa.pub" key that we just created.

root@home> cat id_rsa.pub >> authorized_keys

7. now we exit from the remote(home) server and go back to your desktop in front of you. And we use the "scp" command to pull down the id_rsa key that we need from your home machine. (like copy but uses ssh to cp from remote machines)

root@firewall'dcomputer> pwd

/root/.ssh/ (this is just to double check we are in the correct folder, that's all)

root@firewall'dcomputer> scp root@123.123.123.123:/root/.ssh/id_rsa ./

8. now after we get the file we need to make sure that it works ok.

root@firewall'dcomputer> ssh -i /root/.ssh/id_rsa 123.123.123.123

Now you should of just automaticly logged in after a short pause, it shouldn't ask for a password or anything.

9. Now exit back to the firewall'd computer. Now the tricky part. We need to establish a ppp connection to the remote(home) computer to finish up.

root@firewall'dcomputer> pppd silent noauth 10.0.2.15:10.0.2.2 pty "ssh -i /root/.ssh/id_rsa -t 123.123.123.123 "pppd silent noauth 10.0.0.2.2:10.0.2.15""

*note that the 10.0.2.2 and the 10.0.2.15 are switched around the second time you type them and the double set of quotes at the end

10. now if that worked, double check your handywork. If you type in "ifconfig" you should see a new ppp0 connection with the ip address 10.0.2.2. Now with that ppp connection chugging into the background, go ahead and ssh into the home machine using the ip address 10.0.2.15. Now if you have the ppp stuff set up you can now ssh or ftp or telnet or whatever back down the pipe using the ip address 10.0.2.2 for the firewalled computer.


Now as long as that virtual private network stays functional you can run home and now can ftp, share files, telnet, X sessions, or whatever with the peace of mind that it's all being encrypted thru a ssh pipe, directly from home to school with no routers or firewalls or nothing standing in your way. Imagine telnet being secure! If you want to you can get fancy and setup the firewalled box as a router and now you have access to the entire firewalled network from home!

That's my little example of bypassing a secure firewall in ten relativly easy steps. Now in order to make it complete you are gonna have to put that ' root@firewall'dcomputer> pppd silent noauth 10.0.2.15:10.0.2.2 pty "ssh -i /root/.ssh/id_rsa -t 123.123.123.123 "pppd silent noauth 10.0.0.2.2:10.0.2.15"" ' stuff in to a shell script and have that shell script be activated by some sort of thing you can do from home. Like sending a special e-mail to trigger it like was suggested or put it on a timer to go off at convenent times.

Good Luck!
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
BTW thats also a good example of why securing a network from the outside is only 1/6 of the art of good security, especially when dealing with powerful linux/unix box. Almost no firewall in the world could stop that sort of thing from happening if you have to allow access to the internet, any root compromised box and you might as well assume that your whole network is a loss until the issue is resolved. Even then a attacker could plop a trojan down in some backwards corner of the network and could come back months, even years and use that to do undectectable warfare on your machines if you aren't paying close enough attention. The devil is in the details.