Putty X11 forwarding with Windows

Today one of my classmates brought up a interesting question that i never thought about
“How could we get X11 forwarding in Windows using Putty?”

one of the reason I never thought about it is that most environment i was working on….
they are all in text mode… but it definitely good to know how to setup x11 forward in Windows

We tried to enable the “Enable X11 forwarding” option in putty but can’t get it to work.
then after we do some research online we realized that we need to have x server on our Windows
machine. So after downloaded and installed Xming X Server for Windows.
We try again and it works!!

nice to know it 🙂

To enable X11 forwarding in Putty

Open Putty connection and go to Connections --> SSH --> X11
and check the "Enable X11 forwarding" box to enable it

In Linux to enable X forwarding

ssh with X parameter

ssh -X username@Remote_Host

[Project] Small temporarily office network 1

1. Network design and diagram (2017/1/19)
2. IP design (2017/1/19)
3. Disaster backup plan (2017/1/19)
4. Recovery plan (2017/1/19)
5. Design prototype. (2017/1/16)
6. Implement design in Hyper-V (2017/1/16)
7. Implement IP design to router
8. Implement design on real machines (2017/3/12)
10. Script (2017/1/20)
11. Internet Messenger (2017/1/21)

Define criteria and needs:

The project is for creating a temporarily internal network for around three to ten people connecting to
the network and sharing files and printers. Also meet the following criteria and needs:
1 No internet connection
2 Computer(Windows, OSX) can share files and using the shearing printer once they connect to the network

Role and devices required:

Device: commercial router
Server: Ubuntu Linux(Role: Printer Server, File Server)

Network diagram

Router -IP Setup

Hosts/Net: 14


Run: sudo ./easy_admin.sh


echo -e "\n\n"
echo "=============================================="
echo "      Easy Admin   Raymond Liu                "
echo "      2017.1.20                               "
echo "=============================================="
echo -e "\n\n"


while [[ "$answer" != 'q' ]]
    echo "(1) Change \"Document\" Password"
    echo "(2) Change \"Music\" Password"
    echo "(3) Change \"Router\" Password"
    echo "(4) Show Document password"
    echo "(5) Show Music password"
    echo "(q) Exit(Quit)"
    echo -e "\n"

    echo -n "Please Enter Your Choice: "; read answer

    case $answer in
          documentnewpwd=`< /dev/urandom tr -dc a-z-0-9 | head -c10`
          (echo $documentnewpwd; echo $documentnewpwd) | smbpasswd -s document
          echo -e $documentnewpwd > documentpwd
          echo -e "\n"
          echo "Document New Password:  "$documentnewpwd
          echo -e "\n"
          musicnewpwd=`< /dev/urandom tr -dc a-z-0-9 | head -c10`
          (echo $musicnewpwd; echo $musicnewpwd) | smbpasswd -s music
          echo -e $musicnewpwd > musicpwd
          echo -e "\n"
          echo "Music New Password:  "$musicnewpwd
          echo -e "\n"
          echo -e "\n\n"
          value=`cat documentpwd`
          echo "Document Password: --->   $value"
          echo -e "\n\n"
          echo -e "\n\n"
          value=`cat musicpwd`
          echo "Music Password: --->   $value"
          echo -e "\n\n"


exit 0

Internet Messenger

Basic prototype done

Setup Ubuntu Linux Server:

Step 1 Install cups and samba

sudo apt-get install cups
sudo apt-get install samba

Step 2 Create Samba user

Create User Account
sudo useradd -M -s /sbin/nologin document
sudo useradd -M -s /sbin/nologin music

Setup password for users"

sudo passwd document
sudo passwd music

$ sudo passwd music
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Add user account to the Samba database:

sudo  smbpasswd -a document
sudo  smbpasswd -a music
$ sudo  smbpasswd -a music
New SMB password:
Retype new SMB password:
Added user music.

Add user to local group

sudo groupadd shareGroup
sudo groupadd documentGroup
sudo groupadd musicGroup
sudo usermod -a -G documentGroup,shareGroup document
sudo usermod -a -G musicGroup,shareGroup music

Step 3 Creating the shared folders

sudo mkdir -p /srv/samba/share/
sudo mkdir -p /srv/samba/document/
sudo mkdir -p /srv/samba/music/

Setup folder permission 

sudo chgrp -R shareGroup /srv/samba/share/
sudo chgrp -R documentGroup /srv/samba/document/
sudo chgrp -R musicGroup /srv/samba/music/
sudo chmod 2770 /srv/samba/share/
sudo chmod 2770 /srv/samba/document/
sudo chmod 2770 /srv/samba/music/

Step 4 Config smb.conf

sudo nano /etc/samba/smb.conf
        path = /srv/samba/share/
        read only = no
        guest ok = no
        valid users = document,music
        force create mode = 0660
        force directory mode = 2770
        force group = shareGroup

        path = /srv/samba/document/
        read only = no
        guest ok = no
        valid users = document
        force create mode = 0660
        force directory mode = 2770
        force user = document
        force group = documentGroup

        path = /srv/samba/music/
        read only = no
        guest ok = no
        valid users = music
        force create mode = 0660
        force directory mode = 2770
        force user = music
        force group = musicGroup

Step 5 Start Samba Service

sudo service smbd stop
sudo service smbd start
sudo service smbd status

Step 6 Config cupsd.conf

sudo nano /etc/cups/cupsd.conf

# Restrict access to the admin pages...
<Location /admin>
Order allow,deny

# Restrict access to the admin pages...
<Location /admin>
Order allow,deny
Allow localhost

Step 7 Start CUPS Service

sudo service cups stop
sudo service cups start
sudo service cups status

view cups admin page on local machines  


Bash On Ubuntu On Windows(Windows Subsystem for Linux)

After Windows 10 Build 14316 or later you can enable Microsoft Windows Subsystem for Linux feature
so you can run Ubuntu in your Windows box.

Check build version

C:\>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name:                   Microsoft Windows 10 Enterprise Evaluation
OS Version:                10.0.14393 N/A Build 14393


Step 1 Click Action center at right button corner and click all settings and
Step 2 On Windows Setting window click “Update & Security
Step 3 Click “For Developer” tab on the left
Step 4 Enable “Developer Mode” and restart the computer
Step 5 After Restart you can now open a command prompt (CMD) or powershell and type “bash“.
It will ask you to install Ubuntu just choose yes “y”

Windows PowerShell

Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\Users\chako> bash
-- Beta feature --
This will install Ubuntu on Windows, distributed by Canonical
and licensed under its terms available here:

Type "y" to continue: y
Downloading from the Windows Store... 100%
Extracting filesystem, this will take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: chako
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Installation successful!
The environment will start momentarily...
Documentation is available at:  https://aka.ms/wsldocs
chako@DESKTOP-ERGD9VC:/mnt/c/Users/chako$ systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
findstr: command not found
systeminfo: command not found

After complete the installation, you can now run “Bash On Ubuntu On Windows” 🙂

chako@DESKTOP-ERGD9VC:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:        14.04
Codename:       trusty