How To: Login to your linux box remotely.

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
emorrp1

How To: Login to your linux box remotely.

Post by emorrp1 »

Rationale:
I can no longer be bothered to lug my laptop around with me anymore, and I've also recently moved all my data to an external HDD, so to work properly, I would have to carry that round with me too. I do not (yet) have a spare box that I can just turn into a full-blown server to solve my document access issues. I want to be able to access my computer from anywhere, also I don't need a gui, so this will give you access to your machine as if you had opened a terminal.

However for those who want guis, simply add the "-X" option to each ssh command, forwarding the graphical server and allowing you to launch guis from the command-line, e.g. "mintupload ~/.profile". The disadvantage of this is it's platform dependent, you need to have an X server running on your guest machine, with means either linux, or mac with the server running.

1) install the openssh-server package (you might have to reboot afterwards). AK Dave recommends securing it, but I haven't got around to following his advice yet: http://forums.linuxmint.com/viewtopic.p ... sh#p148429
2) if you're lucky enough to have a static IP, you're done: find your IP by right-clicking on the network-manager, selecting connection info. You can now login to your machine using the following command from any remote linux box (look at Putty for windows):

Code: Select all

ssh username@ip.add.re.ss
if like me, not only do you not have a static IP address, but you're also behind a stupid campus firewall that doesn't even allow you to ping your IP address, then it's more complicated:
3) get an account hosted somewhere that you can ssh into. In my case I'm using my department's servers, where we get a free account.
4) setup a "reverse ssh tunnel" from your machine to the server (PORT should be a high numbered, four figures, port on the server, e.g. 1234):

Code: Select all

ssh -NR PORT:localhost:22 server_username@remote-server.com
5) while that program is running, you can first logon to the server:

Code: Select all

ssh server_username@remote-server.com
6) then from there you can logon to your machine:

Code: Select all

ssh -p PORT username@localhost
viola, you can now login from anywhere in world (well, at least anywhere you can get to the server)

EDIT: just noticed this howto for securing the ssh server: http://forums.linuxmint.com/viewtopic.php?f=42&t=19183
Last edited by emorrp1 on Wed Jun 10, 2009 11:39 am, edited 2 times in total.
User avatar
grimdestripador
Level 6
Level 6
Posts: 1051
Joined: Fri Feb 16, 2007 2:26 am

Re: How To: Login to your linux box remotely.

Post by grimdestripador »

I thought I'd get an explanation of how to pass a X11 session through SSH.
emorrp1

Re: How To: Login to your linux box remotely.

Post by emorrp1 »

there you go grimdestripador, it's as simple as adding the -X option.
User avatar
grimdestripador
Level 6
Level 6
Posts: 1051
Joined: Fri Feb 16, 2007 2:26 am

Re: How To: Login to your linux box remotely.

Post by grimdestripador »

of all things, I have yet to do this sucessfully.
emorrp1

Re: How To: Login to your linux box remotely.

Post by emorrp1 »

hmm, you may be right, I just tried the X forwarding now and it didn't work, anyone have any ideas?
bolle

Re: How To: Login to your linux box remotely.

Post by bolle »

Can i do this on an ipod touch jailbroken with a terminal app on it?
Thanks
emorrp1

Re: How To: Login to your linux box remotely.

Post by emorrp1 »

Most of the hard part is on the host system end, you should be able to connect to it using any device that can run an ssh client program (you probably need to install openssh according to many google results)
jessewilliams

Re: How To: Login to your linux box remotely.

Post by jessewilliams »

Brilliant! Thanks for the heads up mate! It never crossed my mind that this was a piece of cake to be do! Followed your steps with no sweat and got it done immediately. Thank for the info! More Power!
emorrp1

Re: How To: Login to your linux box remotely.

Post by emorrp1 »

Glad I could help, JesseWilliams, though I should probably update this how-to with what I now know about dyndns.org - an amazing site that effectively gives you a free domain tied to your non-fixed IP, allowing you to be done after step 2! It also gets around the issue of having to know in advance you're going to need access.
User avatar
ibm450
Level 5
Level 5
Posts: 650
Joined: Sun Jan 11, 2009 6:56 am
Location: Hamilton Hill, Western Australia

Re: How To: Login to your linux box remotely.

Post by ibm450 »

Team viewer, easy to use, has linux version also, free and works fast
HP EILITE FOLIO 9470M i7-3667u x 4
GitHub: tolgaerok
Image Image
DrHu

Re: How To: Login to your linux box remotely.

Post by DrHu »

No machine NX is also worth a look
http://linuxgazette.net/135/knaggs.html
designwebs

Re: How To: Login to your linux box remotely.

Post by designwebs »

I like to use teamviewer myself.
paulc

Re: How To: Login to your linux box remotely.

Post by paulc »

ssh is the best & easiest way, and safest.
$ ssh username@IP_ADDRESS
I would for sure block telnet & ftp as insecure. scp, putty, winscp, ssh, the best & safest way to get back & forth.
User avatar
Pierre
Level 21
Level 21
Posts: 13182
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: How To: Login to your linux box remotely.

Post by Pierre »

Team viewer, easy to use, has linux version also, free and works fast
+1.
Image
Please edit your original post title to include [SOLVED] - when your problem is solved!
and DO LOOK at those Unanswered Topics - - you may be able to answer some!.
wagonlips

Re: How To: Login to your linux box remotely.

Post by wagonlips »

I find that if I reboot my machine remotely I am effectively locked out. None of the services, such as ssh, start up until I physically login. How can I rectify this?

Linux Mint 11 Katya (GNU/Linux 2.6.38-8-generic x86_64)
electroaudio
Level 1
Level 1
Posts: 14
Joined: Sun Nov 27, 2011 6:09 pm

Re: How To: Login to your linux box remotely.

Post by electroaudio »

emorrp1 wrote: However for those who want guis, simply add the "-X" option to each ssh command, forwarding the graphical server and allowing you to launch guis from the command-line, e.g. "mintupload ~/.profile". The disadvantage of this is it's platform dependent, you need to have an X server running on your guest machine, with means either linux, or mac with the server running.

There is a x-win server for windows too called x-ming http://sourceforge.net/projects/xming/
Xming works just as well as a normal xserver for both for the terminal and for graphical programs, but...
Post Reply

Return to “Tutorials”