Thursday, October 16, 2014

Traveling login

When you sit down at a Windows PC and log in, you begin a Console session which differs from the session that starts when you log in remotely. There can only be one Console session, but there can be any number of remote sessions using terminal services. Why is this distinction important? Sometimes, you may need to transfer your login from a remote session to the Console, so that you can fool a service into thinking that you are actively logged into the Console. For example there is a free service named after a certain fish often served in sushi, Yellowtail, that will disconnect if it senses that you are no longer actively connected to a session.


Here's the trick:
  1. Log in remotely to the Console session.
  2. $ mstsc.exe /console /v:your-server-name
  3. Disconnect, but do not log out.
  4. Log in remotely to another session.
  5. $ mstsc.exe /v:your-server-name
  6. View the logged on users.
  7. $ query user
     USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
     my-user-name          console             0  Disc        none   10/16/2014 9:03 AM
    >my-user-name          rdp                 1  Active      none   10/16/2014 9:03 AM
  8. If this doesn't work try qwinsta
  9. $ qwinsta
     SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
     console           my-user-name              0  Disc
    >rdp               my-user-name              1  Active
  10. Switch to the console.
  11. $ tscon 1 /dest:console

A dialog window will pop up stating that you have been logged off of the computer, because you have logged in somewhere else (duh, at the console!). You can still log back into the computer using Remote Desktop Connection. If you check the users again, you'll see that you are actively logged in twice! Your console login remains active. Mission accomplished.

Peer-To-Peer Virtual Private Network (P2P VPN)

Also known as SocialVPN, this is a network that is very similar to an ad-hoc or peer-to-peer local network between computers connected via LAN cables or WiFi, but connects instead via a VPN tunnel through the internet. There are several services that purport to offer free (or freemium) P2P VPN services.

  • Hamachi, named after a certain fish often served in sushi, Yellowtail, may be the most well known freemium P2P VPN service. It is extremely fast and reliable, but the free service is limited to 5 clients and will shut down if it detects that you have disconnected. Paid service offers up to 32 clients starting at $29/year. It is available on Windows, Mac and Linux. Although the Linux version is Beta it works fine.
  • NeoRouter is a freemium service that at least by their comparison chart, is superior to Hamachi, but I have not tried it. Domain hosting is offered by NeoRouter for $15/month for up to 15 clients, which is a lot more than Hamachi! However, users can set up there own NeoRouter Server, the client and server installation is the same package, which can host the NeoRouter domain. If the server does not have a public IP, then port forwarding must be configured, so there are some hoops to jump through. It is available on all platforms. A Professional version offers support.
  • Remobo was a free cloud service with a Pro version that offered support, but it is now offline.
  • Wippien
  • n2n
  • Gbridge
  • P2PVPN
  • IPOP SocialVPN
  • OpenVPN
  • PeerVPN

Remote Desktop Connections from Linux to Windows using Hamachi

This is pretty straight forward.
  1. Download and install a Hamachi service on your Windows machine. You can create a profile at LogMeIn Central to monitor your Hamachi networks.
  2. Log in to the Windows machine and switch the login to the console leaving it active. You can check its status on your LogMeIn Central profile under My Networks.
  3. Download the beta Hamachi Linux version and install it on your Linux box. For Ubuntu, use the *.deb file and execute sudo dpkg -i logmein-hamachi_VERSION_PLATFORM.deb where VERSION and PLATFORM may differ.
  4. start hamachi
  5. $ sudo hamachi login
    logging in ....... ok
    $ sudo hamachi join MYNETWORK MYPASSWORD
    Joining MYNETWORK ........ ok
    $ sudo hamachi list
    * [MYNETWORK] capacity 2/5, subscription type: Free, owner: you@your-email.com
        123-456-789  MYWINDOWSMACHINE  25.12.34.56  alias: not set
  6. Use the Hamachi network IP address to start remote desktop, my version of Ubuntu already had this installed, but if not use sudo apt-get install rdesktop.
  7. $ rdesktop 25.12.34.56
  8. When the windows opens, log into your windows machine. To get a full screen, use -f option. A graphical client is also available, use sudo apt-get install grdesktop to install.
  9. You can mount a share on the Windows machine.
  10. $ mkdir –p /home/my-linux-profile/winshare
    $ sudo mount –t cifs //25.12.34.56/myshare /home/my-profile/winshare \
      –o username=myWindowsUsername,password=myWindowsPassword,domain=myWindowsDomain,rw
    $ cd /home/my-linux-profile/winshare
    
  11. Or use samba
  12. $ smbclient \\\\MYWINDOWSMACHINE\\MYSHARE –U MYWINDOWSUSERNAME
    smb : \>
    
  13. Or use the Nautilus graphical file browser to mount and browse the shares on your Windows machine.
Enjoy!
Fork me on GitHub