Skip to content

Instantly share code, notes, and snippets.

@velp
Last active December 21, 2016 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velp/82df2569291a6b009597bcc288b399e8 to your computer and use it in GitHub Desktop.
Save velp/82df2569291a6b009597bcc288b399e8 to your computer and use it in GitHub Desktop.
# install requerements
sudo apt-get -y update
sudo apt-get -y install pkg-config libx11-dev libxfixes-dev libssl-dev libpam0g-dev libtool libjpeg-dev flex bison gettext autoconf libxml-parser-perl libfuse-dev xsltproc libxrandr-dev python-libxml2 nasm xserver-xorg-dev fuse
sudo apt-get -y install git
sudo apt-get -y install xfce4 xfce4-goodies tightvncserver xfonts-base xfonts-75dpi xfonts-100dpi
sudo apt-get -y install xrdp
sudo apt-get -y remove xrdp
cd /tmp
# build xrdp
git clone https://github.com/neutrinolabs/xrdp.git
cd  ./xrdp/
# needed because libtool not found in Ubuntu 15.04 and later need to use libtoolize
sed -i.bak 's/which libtool/which libtoolize/g' bootstrap
sudo ./bootstrap
sudo ./configure --enable-fuse --enable-jpeg
sudo make
sudo -k checkinstall \
    --pkgsource="https://github.com/neutrinolabs/xrdp.git" \
    --pkglicense="GPL2" \
    --deldesc=no \
    --nodoc \
    --maintainer="$USER\\<$USER@$HOSTNAME\\>" \
    --pkgarch=$(dpkg \
    --print-architecture) \
    --pkgversion="0.9.1" \
    --pkgrelease="SNAPSHOT" \
    --pkgname=nethogs \
    --requires="adduser, libc6 \(\>= 2.15\), libpam0g \(\>= 0.99.7.1\), libssl1.0.0 \(\>= 1.0.0\), libx11-6, libxfixes3, tightvncserver"
## build xorgxrdp
git clone https://github.com/neutrinolabs/xorgxrdp.git
cd ./xorgxrdp/
sudo ./bootstrap
sudo ./configure
sudo make
sudo -k checkinstall \
    --pkgsource="https://github.com/neutrinolabs/xorgxrdp.git" \
    --pkglicense="GPL2" \
    --deldesc=no \
    --nodoc \
    --maintainer="$USER\\<$USER@$HOSTNAME\\>" \
    --pkgarch=$(dpkg \
    --print-architecture) \
    --pkgversion="0.2.0" \
    --pkgrelease="SNAPSHOT" \
    --pkgname=nethogs \
    --requires="xrdp \(\>= 0.9.0\)"
# Post install settings
sudo sed -i.bak '/\[xrdp1\]/i [xrdp0] \nname=SessionManager-Griffon \nlib=libxup.so \nusername=ask \npassword=ask \nip=127.0.0.1 \nport=-1 \nxserverbpp=24 \ncode=20 \n' /etc/xrdp/xrdp.ini
sudo mv /etc/xrdp/startwm.sh /etc/xrdp/startwm.sh.backup
sudo ln -s /etc/X11/Xsession /etc/xrdp/startwm.sh
sudo mkdir /usr/share/doc/xrdp
sudo cp /etc/xrdp/rsakeys.ini /usr/share/doc/xrdp/rsakeys.ini
# change xrdp config
sudo mv /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.bak
sudo -k cat >/etc/myconfig.conf <<EOL
[Globals]
ini_version=1
fork=true
port=3389
tcp_nodelay=true
tcp_keepalive=true
security_layer=negotiate
crypt_level=high
certificate=
key_file=
autorun=
allow_channels=true
allow_multimon=true
bitmap_cache=true
bitmap_compression=true
bulk_compression=true
max_bpp=32
new_cursors=true
use_fastpath=both
blue=009cb5
grey=dedede
ls_top_window_bg_color=009cb5
ls_width=350
ls_height=430
ls_bg_color=dedede
ls_logo_filename=
ls_logo_x_pos=55
ls_logo_y_pos=50
ls_label_x_pos=30
ls_label_width=60
ls_input_x_pos=110
ls_input_width=210
ls_input_y_pos=220
ls_btn_ok_x_pos=142
ls_btn_ok_y_pos=370
ls_btn_ok_width=85
ls_btn_ok_height=30
ls_btn_cancel_x_pos=237
ls_btn_cancel_y_pos=370
ls_btn_cancel_width=85
ls_btn_cancel_height=30

[Logging]
LogFile=xrdp.log
LogLevel=DEBUG
EnableSyslog=true
SyslogLevel=DEBUG

[Channels]
rdpdr=true
rdpsnd=true
drdynvc=true
cliprdr=true
rail=true
xrdpvr=true
tcutils=true

[Xorg]
name=Xorg
lib=libxup.so
username=ask
password=ask
ip=127.0.0.1
port=-1
code=20
EOL
# restart service
service xrdp restart

Add users:

sudo useradd -m -N -s /bin/bash user1
sudo passwd user1

Configure base desktop settings in RDP session with new user. Copy settings to default directory:

$ sudo cp -r /home/user1/.config/xfce4 /etc/skel/.config/xfce4
$ sudo tree -aC /etc/skel/
/etc/skel/
├── .bash_logout
├── .bashrc
├── .config
│   └── xfce4
│       ├── desktop
│       │   ├── icons.screen0-1008x672.rc
│       │   └── icons.screen0-1008x752.rc
│       ├── panel
│       │   ├── launcher-10
│       │   │   └── 14823320262.desktop
│       │   ├── launcher-11
│       │   │   └── 14823320263.desktop
│       │   ├── launcher-12
│       │   │   └── 14823320264.desktop
│       │   └── launcher-9
│       │       └── 14823320261.desktop
│       ├── xfconf
│       │   └── xfce-perchannel-xml
│       │       ├── keyboard-layout.xml
│       │       ├── thunar.xml
│       │       ├── xfce4-desktop.xml
│       │       ├── xfce4-keyboard-shortcuts.xml
│       │       ├── xfce4-panel.xml
│       │       ├── xfwm4.xml
│       │       └── xsettings.xml
│       └── xfwm4
└── .profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment