LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-12-2016, 08:35 AM   #1
manashpal
LQ Newbie
 
Registered: Nov 2016
Posts: 15

Rep: Reputation: Disabled
How to get a remote access on a guest session in ubuntu from another linux machine


I tried to get control over a guest session in another linux system from also a linux system via ssh.
I have experienced the following :

1) can get control over any sudo session remotely via ssh

But

2) cannot get control over any guest session of a linux system remotely via ssh

output is :
" ssh: connect to host 192.xxx.x.x port 22: Connection timed out "


How can I make it happen ? thanks in advance.
 
Old 12-12-2016, 10:30 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
SSH is Secure Shell; i.e., you are on machine A and you want to connect to machine B and do some work (in a terminal session).

You open a terminal on machine A and log in as a non-root user (we'll talk about root access later).

You execute ssh-keygen which will create a directory, ~/.ssh in the home directory of the user you are logged in as. What ssh-keygen does is create encrypted key files, one named id_rsa and the other id_rsa.pub that are owned by the userid that created them with appropriate permissions; id_rsa is readable only by the ower, id_rsa.pub is readable by any user, both files are write enabled only for the owner.

The resulting directory looks like this:
Code:
ls -l ~/.ssh          <this is how you list the directory in the home directory>
total 8
-rw------- 1 joeytest users 1675 Dec 12 10:44 id_rsa
-rw-r--r-- 1 joeytest users  396 Dec 12 10:44 id_rsa.pub
The same thing has to happen on machine B -- by that user -- and on any other machines you want to connect to also by those users.

When that's all done and you're ready to connect to machine B (and you know the user account name and the password that you entered when running ssh-keygen), you can connect to the remote machine with this command:
Code:
ssh -l trona fubar.lan
The authenticity of host 'fubar.lan (192.168.1.10)' can't be established.
ECDSA key fingerprint is SHA256:awSn9jmaCWsvTqELFoe2dL1NX0+rqZN7CXtX228kaRQ.
Are you sure you want to continue connecting (yes/no)?
You would type the word "yes" when you see that, and you will be prompted for the password and you'll get connected.

That is, I've connected the user joeytest to the user trona on fubar.lan.

That's how you do it. Note that none of that gobbledygook in that authenticity above is usable on anything else, it's what happen on my system, yours will look similar.

Now, by default, you will not be able to connect as root with ssh from one machine to another even if you know the root passwords on other machines. That's not a bad thing as you can do tremendous damage with root access. It's better to connect remotely and then use either sudo or su - on that machine if you absolutely need to do work as root (there is a way and if you want to know ask and I'll tell you but I do discourage it).

Hopefully, your machines have names and fixed-IP addresses or DHCP configured with a name and address. The reason I can connect with a simple "fubar.lan" is that fubar.lan has a fixed IP address and an entry in the file /etc/hosts that looks like this:
Code:
192.168.1.10		fubar.lan fubar
that allows me to connect to any system in my network with ssh systemname rather that entering the complete machine address. Otherwise you must use the complete address of the machine on the remote server. You can also have external addresses in /etc/hosts, for example 75.126.162.205 www.linuxquestions.org linuxquestions.org
which avoids going through a DNS lookup.

Hope this helps some.

Last edited by tronayne; 12-12-2016 at 10:33 AM.
 
Old 12-20-2016, 10:47 AM   #3
Rickkkk
Senior Member
 
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
I'm wondering if the OP is looking more at attempting VNC-like remote-control instead of a standard ssh session (hence his mention of an existing guest session on the remote machine). If this is the case, there are X11-VNC tools available to enable this. I won't go any further until the OP's intentions become clearer.

Cheers,
 
Old 12-20-2016, 12:41 PM   #4
erik2282
Member
 
Registered: May 2011
Location: Texas
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 831

Rep: Reputation: 229Reputation: 229Reputation: 229
Unless the OP is looking for an alternative to the ssh protocol (which I'm not getting from his post) he specifically asked how to perform an action via ssh.
 
Old 12-20-2016, 01:05 PM   #5
Rickkkk
Senior Member
 
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Quote:
Originally Posted by erik2282 View Post
Unless the OP is looking for an alternative to the ssh protocol (which I'm not getting from his post) he specifically asked how to perform an action via ssh.
... quite possible I'm reading more into his post than necessary ;-)

... it's the part where he says he wants to remotely access a "guest session " on an Ubuntu computer from another Ubuntu computer ... Made me think of when one wants to remotely control an existing live user session, for remote assistance, for example .... I figured he may have specifically referred to ssh simply because he didn't know of any other remote access tools.

If I'm wrong, then the previous poster's detailed ssh explanation should do the trick.

Cheers :-)
 
Old 12-20-2016, 02:42 PM   #6
erik2282
Member
 
Registered: May 2011
Location: Texas
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 831

Rep: Reputation: 229Reputation: 229Reputation: 229
You could be right, Rick. I guess we'll wait to see what OP says. =)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
no xauth data for X-session with a remote machine isnurmi Linux - Security 3 07-28-2016 08:06 PM
LXer: How To Access Virtualbox Shared Folder From Ubuntu 12.04 Guest Machine LXer Syndicated Linux News 0 06-09-2012 07:00 AM
How do I Remote access/Desktop Linux from a Windows machine Zed Supremus Linux - Networking 6 09-04-2011 12:11 AM
[SOLVED] How do I Remote access a Linux machine from a other Linux/Windows machine unkn(0)wn Linux - Newbie 6 08-27-2011 07:35 AM
How to do remote access to a Linux machine using Windows XP cucolin@ Linux - Software 3 06-01-2006 01:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration