Skip to content

Instantly share code, notes, and snippets.

@mimura1133
Last active January 29, 2023 21:24

Revisions

  1. mimura1133 revised this gist Jan 31, 2020. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,8 @@ systemctl enable xrdp-sesman

    # Configure the installed XRDP ini files.
    # use vsock transport.
    sed -i_orig -e 's/use_vsock=false/use_vsock=true/g' /etc/xrdp/xrdp.ini
    # sed -i_orig -e 's/use_vsock=false/use_vsock=true/g' /etc/xrdp/xrdp.ini
    sed -i_orig -e 's/port=3389/port=vsock://-1:3389/g' /etc/xrdp/xrdp.ini # 2020.1 support.
    # use rdp security.
    sed -i_orig -e 's/security_layer=negotiate/security_layer=rdp/g' /etc/xrdp/xrdp.ini
    # remove encryption validation.
  2. mimura1133 revised this gist Jan 3, 2020. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -65,6 +65,7 @@ EOF
    ###############################################################################
    # .xinitrc has to be modified manually.
    #
    echo "exec gnome-session" > ~/.xinitrc
    #echo "exec gnome-session" > ~/.xinitrc
    echo "exec startxfce4" > ~/.xinitrc # thanks @rasschaert and @patrickceg.
    echo "You will have to configure .xinitrc to start your windows manager, see https://wiki.archlinux.org/index.php/Xinit"
    echo "Reboot your machine to begin using XRDP."
  3. mimura1133 revised this gist Oct 30, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ if [ "$(id -u)" -ne 0 ]; then
    exit 1
    fi

    #apt update && apt upgrade -y
    apt update && apt upgrade -y

    if [ -f /var/run/reboot-required ]; then
    echo "A reboot is required in order to proceed with the install." >&2
  4. mimura1133 revised this gist Oct 30, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ if [ "$(id -u)" -ne 0 ]; then
    exit 1
    fi

    apt update && apt upgrade -y
    #apt update && apt upgrade -y

    if [ -f /var/run/reboot-required ]; then
    echo "A reboot is required in order to proceed with the install." >&2
  5. mimura1133 revised this gist Oct 30, 2018. 1 changed file with 7 additions and 13 deletions.
    20 changes: 7 additions & 13 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -53,19 +53,13 @@ if [ ! -e /etc/modules-load.d/hv_sock.conf ]; then
    fi

    # Configure the policy xrdp session
    cat > /etc/polkit-1/rules.d/02-allow-colord.rules <<EOF
    polkit.addRule(function(action, subject) {
    if ((action.id == "org.freedesktop.color-manager.create-device" ||
    action.id == "org.freedesktop.color-manager.modify-profile" ||
    action.id == "org.freedesktop.color-manager.delete-device" ||
    action.id == "org.freedesktop.color-manager.create-profile" ||
    action.id == "org.freedesktop.color-manager.modify-profile" ||
    action.id == "org.freedesktop.color-manager.delete-profile") &&
    subject.isInGroup("users"))
    {
    return polkit.Result.YES;
    }
    });
    cat > /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla <<EOF
    [Allow Colord all Users]
    Identity=unix-user:*
    Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile
    ResultAny=no
    ResultInactive=no
    ResultActive=yes
    EOF

    ###############################################################################
  6. mimura1133 created this gist Oct 30, 2018.
    76 changes: 76 additions & 0 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,76 @@
    #!/bin/bash
    # Original : https://raw.githubusercontent.com/Microsoft/linux-vm-tools/master/arch/install-config.sh

    ###############################################################################
    # Update our machine to the latest code if we need to.
    #

    if [ "$(id -u)" -ne 0 ]; then
    echo 'This script must be run with root privileges' >&2
    exit 1
    fi

    apt update && apt upgrade -y

    if [ -f /var/run/reboot-required ]; then
    echo "A reboot is required in order to proceed with the install." >&2
    echo "Please reboot and re-run this script to finish the install." >&2
    exit 1
    fi

    ###############################################################################
    # Install XRDP
    #
    apt install -y xrdp

    ###############################################################################
    # Configure XRDP
    #
    systemctl enable xrdp
    systemctl enable xrdp-sesman

    # Configure the installed XRDP ini files.
    # use vsock transport.
    sed -i_orig -e 's/use_vsock=false/use_vsock=true/g' /etc/xrdp/xrdp.ini
    # use rdp security.
    sed -i_orig -e 's/security_layer=negotiate/security_layer=rdp/g' /etc/xrdp/xrdp.ini
    # remove encryption validation.
    sed -i_orig -e 's/crypt_level=high/crypt_level=none/g' /etc/xrdp/xrdp.ini
    # disable bitmap compression since its local its much faster
    sed -i_orig -e 's/bitmap_compression=true/bitmap_compression=false/g' /etc/xrdp/xrdp.ini
    sed -n -e 's/max_bpp=32/max_bpp=24/g' /etc/xrdp/xrdp.ini
    sed -i_orig -e 's/X11DisplayOffset=10/X11DisplayOffset=0/g' /etc/xrdp/sesman.ini
    # rename the redirected drives to 'shared-drives'
    sed -i_orig -e 's/FuseMountName=thinclient_drives/FuseMountName=shared-drives/g' /etc/xrdp/sesman.ini

    # Change the allowed_users
    echo "allowed_users=anybody" > /etc/X11/Xwrapper.config


    #Ensure hv_sock gets loaded
    if [ ! -e /etc/modules-load.d/hv_sock.conf ]; then
    echo "hv_sock" > /etc/modules-load.d/hv_sock.conf
    fi

    # Configure the policy xrdp session
    cat > /etc/polkit-1/rules.d/02-allow-colord.rules <<EOF
    polkit.addRule(function(action, subject) {
    if ((action.id == "org.freedesktop.color-manager.create-device" ||
    action.id == "org.freedesktop.color-manager.modify-profile" ||
    action.id == "org.freedesktop.color-manager.delete-device" ||
    action.id == "org.freedesktop.color-manager.create-profile" ||
    action.id == "org.freedesktop.color-manager.modify-profile" ||
    action.id == "org.freedesktop.color-manager.delete-profile") &&
    subject.isInGroup("users"))
    {
    return polkit.Result.YES;
    }
    });
    EOF

    ###############################################################################
    # .xinitrc has to be modified manually.
    #
    echo "exec gnome-session" > ~/.xinitrc
    echo "You will have to configure .xinitrc to start your windows manager, see https://wiki.archlinux.org/index.php/Xinit"
    echo "Reboot your machine to begin using XRDP."