Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

For the experiment purpose I need to login to my own PC from the remote PCs which are under the same domain, i.e: university network. How can I do remote login in this case using SSH?

As an example, I have accounts in two machines in University X which are me@machine_a.cs.x.ca and me@machine_b.cs.x.ca, my personal laptop account is nawshad@ubuntu. What extra info do I need to provide?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

As daveh's answer points out, that could be as simple as just issuing ssh nawshad@ipaddress.

However, chances are that your PC is not accessible directly from the internet, i.e. it sits behind a router of some sort.

One option is to tell the router to let traffic to your PC pass through. How you do this depends on the router. This options only works if you have administrative access to the router, and that there are no other routers involved.

Another option is to create a reverse SSH tunnel, i.e. from your PC, you log into one (or both) of your university machines, creating at the same time a tunnel from the university machines to the SSH port of your PC. You leave that connection on when you are at university, which allows you to log back into your PC using the tunnel that was created by the SSH session.

This process has been described by http://www.vdomck.org/2005/11/reversing-ssh-connection.html; sorry for the link, but I don't want to copy all the information from there to here.

In principle, the command you issue from your PC is (assuming you want to connect from me@machine_b.cs.x.ca)

ssh -f -N -R 10000:localhost:22 me@machine_b.cs.x.ca

Then, when at university, you can connect to your home PC with the following command:

ssh -p 10000 nawshad@localhost

You can change the 10000 in both commands to a different value; just make sure that it is larger than 1024.

Note: while this tunnel is alive, everyone with access to machine_b.cs.x.ca can try to log into your system; make sure that you have good passwords.

To shut down the tunnel, just kill the corresponding ssh process, e.g. with

pkill -f 'ssh -f -N -R 10000:localhost:22 me@machine_b.cs.x.ca'
share|improve this answer

Yes. This is very much a case for using SSH.

Unless your personal machine is registered with the DNS at your university (which is unlikely) you would be best off doing this via ipaddress.

First ensure that SSH is enabled on your personal machine. Check with ps -ef | grep sshd | grep -v grep and if not install and start sshd.

Once its running try to ssh to your machine via IP address, eg ssh nawshad@0.0.0.0 you should be prompted for your password.

Good luck!

share|improve this answer
    
When I ran ps -ef | grep ssh, I found the following:nawshad 2898 2512 0 23:18 pts/0 00:00:00 grep --color=auto sshd Does it mean that I dont have ssh enabled in my personal laptop? –  MiNdFrEaK Sep 7 '12 at 3:23
    
No. Thats the grep query itself. SSH is not running on your machine. Let me update the query to exclude that –  daveh Sep 7 '12 at 4:27
    
This only works if the PC is actually directly connected to the internet, which is pretty unlikely. –  daniel kullmann Sep 7 '12 at 9:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.