How To: Login to your linux box remotely.

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
Post Reply
emorrp1
Level 8
Level 8
Posts: 2158
Joined: Thu Feb 26, 2009 8:58 pm

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.
If you have a question that has been answered and solved, then please edit your original post and put a [SOLVED] at the end of your subject header
Hint - use a google search including the search term site:forums.linuxmint.com
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
Level 8
Level 8
Posts: 2158
Joined: Thu Feb 26, 2009 8:58 pm

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.
If you have a question that has been answered and solved, then please edit your original post and put a [SOLVED] at the end of your subject header
Hint - use a google search including the search term site:forums.linuxmint.com
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
Level 8
Level 8
Posts: 2158
Joined: Thu Feb 26, 2009 8:58 pm

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?
If you have a question that has been answered and solved, then please edit your original post and put a [SOLVED] at the end of your subject header
Hint - use a google search including the search term site:forums.linuxmint.com
bolle
Level 3
Level 3
Posts: 132
Joined: Sat Jul 25, 2009 8:53 pm

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
Level 8
Level 8
Posts: 2158
Joined: Thu Feb 26, 2009 8:58 pm

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)
If you have a question that has been answered and solved, then please edit your original post and put a [SOLVED] at the end of your subject header
Hint - use a google search including the search term site:forums.linuxmint.com
jessewilliams
Level 1
Level 1
Posts: 5
Joined: Wed May 26, 2010 10:54 am

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
Level 8
Level 8
Posts: 2158
Joined: Thu Feb 26, 2009 8:58 pm

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.
If you have a question that has been answered and solved, then please edit your original post and put a [SOLVED] at the end of your subject header
Hint - use a google search including the search term site:forums.linuxmint.com
User avatar
ibm450
Level 5
Level 5
Posts: 624
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
Sony i3 - VPCEB13FG SSD 4GB laptop ~ MX-Linux & Plasma - LMDE4 - Kubuntu 20.04 - Win 10 LTSC De-bloated
Image Image
User avatar
DrHu
Level 17
Level 17
Posts: 7522
Joined: Wed Jun 17, 2009 8:20 pm

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
Level 1
Level 1
Posts: 4
Joined: Thu Jul 22, 2010 2:55 pm

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

Post by designwebs »

I like to use teamviewer myself.
paulc
Level 1
Level 1
Posts: 19
Joined: Thu Jul 22, 2010 7:35 pm

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 20
Level 20
Posts: 10937
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
Level 1
Level 1
Posts: 2
Joined: Fri Nov 18, 2011 4:00 am

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”