25

I was wondering if there is a way to make Cinnamon 1.4 the default environment upon logging in to Ubuntu 12.04. I can install Cinnamon 1.4 without any problems, but I am trying to run XRDP to log in from a Windows machine and would like it to start "Cinnamon session" instead of a Unity session by default.

The question is, How can I tell XRDP to use Cinnamon instead of Unity upon logging in?

XRDP seems to work much better than any VNC based servers.

Amith KK
  • 13,372
  • 13
  • 66
  • 121
Jeff
  • 251
  • 1
  • 3
  • 3

9 Answers9

32

Found this on the net, on this url: http://sigkillit.com/tag/xrdp

Customize Desktop Environment for xRDP Session

If you do not want to use the default desktop environment, you can customize it by creating a .Xclients file (X is capital!!!) in your home directory to launch the desktop environment you want and making it executable. In order to do this, open a terminal and run one of the following commands

Gnome 3:

echo "gnome-session" > ~/.Xclients
chmod +x ~/.Xclients
sudo systemctl restart xrdp.service

Gnome Fallback:

echo "gnome-fallback" > ~/.Xclients
chmod +x ~/.Xclients
sudo systemctl restart xrdp.service

KDE:

echo "startkde" > ~/.Xclients
chmod +x ~/.Xclients
sudo systemctl restart xrdp.service

MATE:

echo "mate-session" > ~/.Xclients
chmod +x ~/.Xclients
sudo systemctl restart xrdp.service

Cinnamon:

echo "cinnamon" > ~/.Xclients
chmod +x ~/.Xclients
sudo systemctl restart xrdp.service

Xfce4:

echo "startxfce4" > ~/.Xclients
chmod +x ~/.Xclients
sudo systemctl restart xrdp.service
Nathan Osman
  • 31,915
  • 40
  • 179
  • 259
user154868
  • 329
  • 3
  • 2
  • Thanks! Even after messing with .xsession etc, none of it worked. I needed a .Xclients file it seems. This was on Fedora 19. – Alex Dec 13 '13 at 08:44
  • The .Xclients file is truly empty? Just created `touch ~/.Xclients` ? – Frank N Feb 13 '16 at 18:20
  • This also works for me on CentOS 7. I've tried many other techniques with no success until this. – cfinley May 31 '17 at 16:56
  • 1
    This does not work for Ubuntu 20.04 anymore. The .Xclients file is completely ignored, no matter what's in there. What worked for me was: `echo startxfce4 > ~/.xsession`. This example is for Xfce, adjust accordingly if you use a different desktop environment. – Martin Hansen Jan 01 '21 at 08:41
  • 3
    For Cinnamon, it's `echo cinnamon-session-cinnamon > ~/.xsession`. The command for your desktop environment that needs to be run in .xsession can be found in `/usr/share/xsessions`. Each installed DE should have its own .desktop file in this folder that contains the start command in the `Exec=` line. – Martin Hansen Jan 01 '21 at 09:01
11

You can start the environment you want only for xrdp (not for local login) in /etc/xrdp/startwm.sh

For example, to start xfce, I use:

#!/bin/sh
if [ -r /etc/default/locale ]; then
  . /etc/default/locale
  export LANG LANGUAGE
fi

# default (= ubuntu)
#. /etc/X11/Xsession

# unity 2d
#echo "gnome-session --session=ubuntu-2d" > ~/.xsession
#. /etc/X11/Xsession

# xfce
startxfce4

exit(0)

Commented out, you can see the commands to start unity (ubuntu session) and unity 2d. You only need to comment out xfce command and add the command to start Cinnamon (I didn't give it because I don't know how to start it manually).

Obs: I agree with you xrdp works better than others remote desktop viewers I tried and it works very well with xfce. I use it from other linux machines too with Remmina client. To use it with xfce, you need to install xubuntu-desktop (sudo apt-get install xubuntu-desktop)

laurent
  • 6,639
  • 1
  • 26
  • 28
3

If you're using Lubuntu Desktop (tested on 12.04 LTS)

  1. For lx syntax discovery:

    ps aux | grep lx
    
  2. Implementing lx syntax:

    echo "lxsession -s Lubuntu -e LXDE" > ~/.xsession    
    sudo service xrdp restart
    
David Foerster
  • 35,754
  • 55
  • 92
  • 145
Bellera
  • 161
  • 2
  • 3
2

First you should have cinnamon on your system :)

Second issue the commands

echo "cinnamon" > ~/.xsession    
sudo service xrdp restart

OR if you like to do it hard:) do the following:

  1. Edit the file /etc/xrdp/startwm.sh

    sudo -H gedit /etc/xrdp/startwm.sh
    
  2. At the end of the file you will find the following lines:

    pre_start
    wm_start
    post_start
    
  3. These are calls to functions above. So in order to make cinnamon the default just put # before wm_start to comment it (to stop calling the function which searches for the sessions)

  4. Add the following line in front of the above three lines gnome-session --session=cinnamon

  5. restart xrdp sudo service xrdp restart

muru
  • 193,181
  • 53
  • 473
  • 722
Maythux
  • 82,867
  • 54
  • 239
  • 271
1

On Kubuntu 20.04 the following worked for me:

echo "startplasma-x11" > ~/.Xsession

I assume similar will work for another desktops, just need to put proper launcher name, as described above.

ivan.ukr
  • 349
  • 4
  • 10
1

For LXDE:

  1. Install lxde-common:

    sudo apt-get install lxde-common
    
  2. Make changes in /etc/xrdp/startwm.sh like this:

    #!/bin/sh
    
    if [ -r /etc/default/locale ]; then
      . /etc/default/locale
      export LANG LANGUAGE
    fi
    
    #. /etc/X11/Xsession
    
    startlxde
    
David Edwards
  • 5,088
  • 3
  • 33
  • 45
user236510
  • 11
  • 1
1

This is all too confusing. All you have to do is put the text in a file called .Xclients in your home directory that will specify the default desktop. To see what's installed on your system and find out what they are called do:

ls /usr/share/xsessions

You will see files with an extension .desktop, for example mate.desktop

To make mate your default desktop you can then edit ~/.Xclients in your home folder, if you have such a file, or create one with nothing in it except your chosen desktop type (without the .desktop extension) with a -session appended:

echo mate-session > ~/.Xclients 

should do this just fine. You can then log off and log back in, or if you are connected using xrdp you can restart xrdp, which will log you off and then you can log back in, (just log off and log back in, its stupid to get confused by restarting xrdp etc...)

Forget switchdesk - its broken in Fedora 23.

Forget most of what's on the web for prior Fedora versions, Ubuntu etc... None of it works.

Len
  • 11
  • 1
0

Here is an update As systemd is used by almost all Linux distributions systemctl command works with ubuntu versions like 18,19,20 and 21.

To use xfce4 Desktop, the commands below can be used:

sesman.ini should be updated accordingly if you intend to have multi-user access.

Policy=UBDC

su -l user
    
echo "startxfce4" > ~/.Xclients
    
chmod +x ~/.Xclients

exit 
su -l user2

echo "startxfce4" > ~/.Xclients

chmod +x ~/.Xclients

exit 
su -l user3

echo "startxfce4" > ~/.Xclients

chmod +x ~/.Xclients

exit 
sudo systemctl enable --now xrdp.service

will enable and start the xrdp service.

ThunderBird
  • 1,915
  • 13
  • 19
  • 31
Badi
  • 1
  • 2
0

The systemctl command is specific to Fedora. For Ubuntu, the command should be:

sudo service xrdp restart
Braiam
  • 66,947
  • 30
  • 177
  • 264
  • Your are incorrect. I have no points to downvote. systemctl is part of systemd and it is nothing to do with Fedora. systemd is used in Debian/Ubuntu. – killdaclick May 25 '22 at 08:18