System administrator

SSH One Computer From Another On Same Newtork

If you have authorized username and password for a different machine(computer) connected on the same network, you can easily ssh into it to access its contents.

For clarity, machine we are using to ssh is referred Machine 1 and machine we have to ssh into is referred Machine 2.

Now here’s how to do it.

First get the IP of the Machine 2. To find IP run the following(in Machine 2):
ifconfig                       #ipconfig for windows

It will output something like:
eth0 Link encap:Ethernet HWaddr 5x:xx:xx:xx:xx:xc
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:19

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:4309 errors:0 dropped:0 overruns:0 frame:0
TX packets:4309 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:539900 (539.9 KB) TX bytes:539900 (539.9 KB)

wlan0 Link encap:Ethernet HWaddr 28:e3:47:6d:29:2c
inet addr:192.168.0.105 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::2ae3:47ff:fe6d:292c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5906878 errors:0 dropped:0 overruns:0 frame:0
TX packets:4779402 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5143419880 (5.1 GB) TX bytes:619868581 (619.8 MB)

As we can see the IP of the machine for wlan0 is 192.168.0.105

Now run the following from Machine 1:
ssh <usser>@<ip-address>

For eg:
ssh shivam@192.168.0.105

When asked enter the password for the user and you can now remotely access Machine 2 from Machine 1.

Advertisements
Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s