Set up a desktop with RDP on Ubuntu 22.04

Post Reply
User avatar
Edge100x
Founder
Founder
Posts: 12945
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Set up a desktop with RDP on Ubuntu 22.04

Post by Edge100x »

Anything in a code block below is designed to be copied-and-pasted into a SSH session. On Windows, you can do this by selecting the text, pressing Control-C, going to your PuTTY (or other SSH client) terminal window, and right-clicking. The text that you are pasting will be selected; just press Enter to have those commands execute.
  1. Start by installing needed packages:

    Code: Select all

    apt-get update
    apt-get install ubuntu-desktop xrdp
    
    Press enter when it asks to confirm that you want these packages installed.
  2. Create a user other than root, to use for your desktop. "John" is used as an example below; replace it with your desired username.

    Code: Select all

    useradd John -g users -G sudo -m
    passwd John
    
    (Then, enter your desired password at the prompts.)
  3. Switch to the new user you created.

    Code: Select all

    sudo -u John /bin/bash
  4. Create a configuration file. to make the remote desktop look like the default one.

    Code: Select all

    cat <<EOF > ~/.xsessionrc
    export GNOME_SHELL_SESSION_MODE=ubuntu
    export XDG_CURRENT_DESKTOP=ubuntu:GNOME
    export XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
    EOF
    
  5. Configure the system to not start the GUI on the default screen (the terminal that shows under the "VNC console" page). You want to be able to access it remotely instead.

    Code: Select all

    systemctl set-default multi-user.target
    
    (If you do want to see the GUI at boot, use systemctl set-default graphical.target. However, please note that a bug in Ubuntu 22.04 seems to prevent the mouse from working right, and it will present some additional configuration screens that push you to create a new user, set a time zone, and some other things.)
  6. Connect to your server IP address using a Remote Desktop Connection, then log in with the username and password that you chose. On Windows:
    1. Press the Start key or click on the start menu
    2. Type Remote
    3. Click the Remote Desktop Connection option
    4. Into the Computer field, enter the IP address of your VDS, from the "IP list" page
    5. Click Connect
    6. When Windows says "The publisher of this remote connection can't be identified...", check "Don't ask me again for connections to this computer" and then click "Connect"
    7. When windows says "The identity of the remote computer cannot be verified..", check "Don't ask me again for connections to this computer" and then click "Connect"
    8. On the Login screen that appears, enter your username and password, then click OK
    Note that we recommend against running desktop applications on a server, for performance, security, and stability reasons. As Ubuntu docs state, a web-based administration package is usually a better choice (or simply using the command-line directly).

    Sources:

    https://askubuntu.com/questions/1233088 ... g-remotely
Post Reply