4

I need to share my pc with a friend of mine living in India.

His pc is a p4 and he needs a bit of horsepower for calculation.

Since I have an i5 I thought to let him vnc and use it but this would not allow me to use the computer at the same time.

Is there a way to use the computer at the same time with different users?

I've read Xorg is able to do this but I am not sure is the best solution nor I can implement it.

We have Ubuntu 12.04 64bit on the i5 side and Ubuntu 12.04 32bit on the p4 side.

Thank you for your kind help.

Seth
  • 58,122
Pitto
  • 1,938
  • Just to clarify, you're not in India right? The network situation is quite important. – Oli Dec 14 '12 at 22:33

2 Answers2

5

It could be easiest to use the built-in methods, already available. If you both have X running, configure SSH on the i5 side. Make sure you have SSH configured with

X11Forward yes

You may need to open port 22 on the router that provides the network on the i5 side, so that the p4 side can connect. When the SSH server is accessible on the Internet, in short time it will get hammered with people attempting to brute-force their way into the machine; so, be sure to install and configure a method to prevent brute force attacks, like DenyHosts or fail2ban.

You may wish to look in your router to see which kind of dynamic DNS it might be able to use and then set up dynamic DNS so that the p4 side can SSH to you by name. (There is also software that could this, and we could devise some hackish methods too, below.) Otherwise, of course, the p4 side would need to know your current IP address.

For the p4 side to connect via SSH with X and compression:

ssh -X -C username@hostname-or-ip-address

For the p4 side to use X applications on the i5 side, just type a command.

xman

Then xman will run on the i5 side, but display on the p4 side.

Of course, a hopefully obvious requirement for the i5 side is that the i5 side needs to create a user account for the p4 user (adduser).

Alternatively, there is something more like the VNC you mentioned, NX. There is a commercial version that is free for Linux, from NoMachine, and there is an open-source version, freenx. With NX, users connect via SSH, and the end user gets a display showing the whole desktop, like VNC or RDP.

Personally, I use NX from NoMachine. My ISP changes my IP address once weekly. I did not want to pay for dynamic DNS, and I did not want to set up dynamic DNS for myself. So, I devised a way to send myself my external IP address once daily (via a script run from cron). First I set up the system to send mail using ssmtp, software made just to send mail. Then I run the script once a day via cron (/etc/cron.daily/ip.sh):

#!/usr/bin/env bash

IP_FILE=/tmp/external-ip-address
CURRENT_IP=$(lynx --dump http://checkip.dyndns.org/)
EMAIL_ADDR=me@mydomain.com

if [ -f $IP_FILE ]; then
    KNOWN_IP=$(cat $IP_FILE)
else
    KNOWN_IP=
fi

if [ "$CURRENT_IP" != "$KNOWN_IP" ]; then
    echo $CURRENT_IP > $IP_FILE
    mailx -s "External IP Address" $EMAIL_ADDR < $IP_FILE
fi

The script requires lynx, bash, and mailx (heirloom-mailx). Though it has nothing to do with crunching numbers, the remote user could also use sshfs to mount the home directory on the i5 side. It is a very convenient way to use X to manage remote files.

  • 2
    This would work well for a LAN but it tends to suck horribly over long internet connections. I believe the Op's PC is in central Europe so there would be a large amount of latency which doesn't suit X forwarding very well. – Oli Dec 14 '12 at 22:35
5

You can install xrdp (sudo apt-get install xrdp) on the i5 side and Remmina (available from Software Center) on the P4 side. This will make him have access to your machine desktop.

I recommend you to set up a new user for him so you won't have problems of the kind "Firefox is already running on this machine..." and your files will be protected and separated from his ones.

To make the connection you will need to open the port corresponding to the connection type you choose in Reminna. I recommend you to use RDP with SSH tunneling (You can configure Reminna to do this alone) and open SSH port (22) on your machine. The security problem of opening this port is to consider and you should install something to block brute force attacks (like fail2ban - in software center too) and only allow ssh connections with ssh-keys, no password and no root login - configurable in /etc/sshd_config). But if you are not familiar with it, see Ubuntu SSH doc

laurent
  • 6,779