Skip to content
TheChatArchiveThe Chat Archive
Geminigemini-2.5-flash· GoogleHugging Face LMArena Human Preference 140K

Role You are an expert in linux desktop systems with 16 years of experience with Ubuntu…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with gpt-4.1-2025-04-14’s answer.
  1. User

    Role

    You are an expert in linux desktop systems with 16 years of experience with Ubuntu and Cinnamon.

    Task

    I want to configure a remote desktop server that can be accessed simultaneously be several users. Because of that I have to restrict access to critical systems, such as power management, network, etc. so that a normal user cannot change the settings. Please give me a list of such components and steps how to disable them.

  2. Gemini Assistant

    Ah, a classic challenge for multi-user Linux environments! Setting up a remote desktop server for simultaneous users, while maintaining system integrity and preventing "normal users" from making critical changes, requires a combination of robust access control and careful configuration. With 16 years on Ubuntu and Cinnamon, I've tackled this many times, and xrdp combined with PolicyKit is your primary weapon.

    The key here is that each user will get their own isolated Cinnamon desktop session via xrdp, which means their personal settings (like desktop background, theme, etc.) won't interfere with others. However, system-wide changes, especially those requiring elevated privileges, are what we need to lock down.

    Let's break down the components you need to restrict and how to do it.


    Core Principles of Restriction

    Before diving into specifics, understand the two main pillars:

    1. sudo and User Groups: This is the most fundamental. Normal users should never be in the sudo group. This prevents them from running sudo apt install, sudo reboot, or any other command with root privileges directly from the terminal.

      • Action: When creating new users, ensure they are not added to the sudo group. You can check this with groups <username>. If sudo is listed, remove them: sudo gpasswd -d <username> sudo.
    2. PolicyKit (Polkit): This is the modern, granular authorization framework used by most desktop environments (including Cinnamon) and system services to decide if a non-root user can perform a privileged action without a password or with a password. This is crucial for GUI-based system settings like network configuration, power management, etc., which often default to allowing administrators or even "console users" (which remote desktop users often appear as) to perform actions.

      • Action: We will create .pkla files in /etc/polkit-1/localauthority/50-local.d/ to override default PolicyKit rules. These files specify which actions are allowed or denied for specific user groups.

    Prerequisites for Multi-User Remote Desktop

    First, let's assume you have a base Ubuntu server or desktop installation.

    1. Install xrdp and Cinnamon:

      sudo apt update
      sudo apt install -y xrdp cinnamon-desktop-environment
      sudo systemctl enable xrdp
      sudo systemctl start xrdp
      

      Note: cinnamon-desktop-environment pulls in the full desktop. If you want a more minimal install, you can install just cinnamon and lightdm (for the display manager setup needed by xrdp).

    2. Configure xrdp to use Cinnamon: Edit /etc/xrdp/startwm.sh. Before the line test -x /etc/X11/Xsession && exec /etc/X11/Xsession, insert:

      # For Cinnamon Desktop
      # If not using LightDM, ensure you have a .xsession or similar
      # For Cinnamon, ensure these lines are present or added:
      if [ -r /etc/default/locale ]; then
          . /etc/default/locale
          export LANG LANGUAGE
      fi
      
      # Explicitly start Cinnamon if it's not the default session
      # This might vary based on your xrdp/lightdm setup, but often works:
      # echo "cinnamon-session" > ~/.xsession
      # and then rely on the exec /etc/X11/Xsession
      
      # A more direct approach that often works:
      # Check if a .xsession file exists or create one for Cinnamon
      # if [ ! -f ~/.xsession ]; then
      #     echo "cinnamon-session" > ~/.xsession
      # fi
      # exec /usr/bin/cinnamon-session # Or your desired DE
      
      # A more reliable way for xrdp when using Cinnamon:
      # Ensure this is set up for lightdm or gnome-session which Cinnamon builds on
      # Add this line before the default Xsession exec:
      echo "cinnamon-session" > "$HOME/.xsession"
      

      After editing, restart xrdp: sudo systemctl restart xrdp.

    3. Add Users:

      sudo adduser <username>
      # Set a strong password
      

      Crucially, do NOT add them to the sudo group.


    Components to Restrict and How to Disable/Restrict Them

    We'll primarily use PolicyKit rules for most of these. Create new .pkla files in /etc/polkit-1/localauthority/50-local.d/. The ResultActive field determines the outcome: yes (allow), no (deny), auth_admin (require admin password), auth_self (require user's own password, if applicable). We'll mostly use no or auth_admin.

    Important: After creating or modifying a .pkla file, you might need to restart polkitd or the user's session for changes to take effect. sudo systemctl restart polkit.service or simply have the user log out and back in.


    1. Power Management (Shutdown, Restart, Suspend, Hibernate)

    • Problem: A normal user can shut down/restart the server, affecting all other users.
    • Restriction: Deny access to login1 actions for non-administrative users.
    • File: /etc/polkit-1/localauthority/50-local.d/01-no-power-actions.pkla
    • Content:
      [Disable Power Actions for Users]
      Identity=unix-group:users;unix-group:lpadmin;unix-group:cdrom;unix-group:plugdev;unix-group:sambashare;!unix-group:sudo
      Action=org.freedesktop.login1.power-off;org.freedesktop.login1.power-off-multiple-sessions;org.freedesktop.login1.reboot;org.freedesktop.login1.reboot-multiple-sessions;org.freedesktop.login1.suspend;org.freedesktop.login1.suspend-multiple-sessions;org.freedesktop.login1.hibernate;org.freedesktop.login1.hibernate-multiple-sessions
      ResultActive=no
      
      Explanation: This rule applies to common non-admin groups. If a user is in sudo, this rule is skipped for them, allowing sudo users to still perform these actions. If you want to deny everyone except root, change Identity to unix-user:* and ResultActive=no.

    2. Network Configuration (Wi-Fi, Ethernet, VPN, DNS, Firewall)

    • Problem: Users can disconnect the server, change IP, DNS, or modify firewall rules, disrupting services or exposing the system.
    • Restriction: Deny NetworkManager system-wide configuration changes and new connection creation. Firewall (ufw) requires sudo anyway.
    • File: /etc/polkit-1/localauthority/50-local.d/02-no-network-changes.pkla
    • Content:
      [Disable Network Manager System Settings for Users]
      Identity=unix-group:users;!unix-group:sudo
      Action=org.freedesktop.NetworkManager.settings.modify.system;org.freedesktop.NetworkManager.settings.modify.own;org.freedesktop.NetworkManager.settings.modify.hostname;org.freedesktop.NetworkManager.network-control;org.freedesktop.NetworkManager.enable-disable-wifi;org.freedesktop.NetworkManager.enable-disable-network;org.freedesktop.NetworkManager.sleep-wake;org.freedesktop.NetworkManager.vpn.control;org.freedesktop.NetworkManager.connection.new;org.freedesktop.NetworkManager.connection.delete;org.freedesktop.NetworkManager.connection.modify
      ResultActive=no
      

    3. User & Group Management

    • Problem: Users can create new accounts, delete existing ones, or change passwords, compromising security.
    • Restriction: These actions are usually restricted by sudo by default. However, desktop tools might try to use PolicyKit.
    • File: /etc/polkit-1/localauthority/50-local.d/03-no-user-management.pkla
    • Content:
      [Disable User Management for Users]
      Identity=unix-group:users;!unix-group:sudo
      Action=org.freedesktop.Accounts.set-enabled;org.freedesktop.Accounts.set-locked;org.freedesktop.Accounts.set-user-attribute;org.freedesktop.Accounts.create-user;org.freedesktop.Accounts.delete-user;org.freedesktop.Accounts.modify-user-privileges;org.freedesktop.Accounts.change-own-password
      ResultActive=no
      
      Note: org.freedesktop.Accounts.change-own-password is included here. If you want users to be able to change their own password, remove that specific action from the Action line or set ResultActive=auth_self for that specific action.

    4. Software Installation & Updates

    • Problem: Users can install malicious software, break dependencies, or consume disk space, or prevent system updates.
    • Restriction: Primarily handled by sudo (users not in the sudo group). For GUI software centers (like "Software" or "Synaptic"), PolicyKit is also involved.
    • File: /etc/polkit-1/localauthority/50-local.d/04-no-software-management.pkla
    • Content:
      [Disable Software Management for Users]
      Identity=unix-group:users;!unix-group:sudo
      Action=org.debian.apt.install-or-remove-packages;org.debian.apt.update-cache;org.debian.apt.upgrade-packages;org.freedesktop.packagekit.install-packages;org.freedesktop.packagekit.remove-packages;org.freedesktop.packagekit.update-packages;org.freedesktop.packagekit.repair-system;org.freedesktop.packagekit.change-locale;org.freedesktop.software-center.install;org.freedesktop.software-center.remove
      ResultActive=no
      
      Note: update-cache and upgrade-packages are usually for GUI updates. If you want them to be able to check for updates but not install, you might fine-tune this. However, denying all is safer for a shared server.

    5. System Time & Date

    • Problem: Incorrect time can affect logging, security, and network services.
    • Restriction: Deny changing system time, date, or NTP settings.
    • File: /etc/polkit-1/localauthority/50-local.d/05-no-time-changes.pkla
    • Content:
      [Disable Time Date Changes for Users]
      Identity=unix-group:users;!unix-group:sudo
      Action=org.freedesktop.timedate1.set-time;org.freedesktop.timedate1.set-timezone;org.freedesktop.timedate1.set-ntp;org.freedesktop.timedate1.set-local-rtc
      ResultActive=no
      

    6. Mounting/Unmounting Filesystems (e.g., USB drives, Network Shares)

    • Problem: Users could unmount critical system partitions (unlikely but possible if misconfigured), or mount malicious USB drives.
    • Restriction: Prevent mounting/unmounting of system-managed devices or devices owned by others.
    • File: /etc/polkit-1/localauthority/50-local.d/06-no-drive-mounts.pkla
    • Content:
      [Disable Disk Mounting/Unmounting for Users]
      Identity=unix-group:users;!unix-group:sudo
      Action=org.freedesktop.udisks2.filesystem-mount-system;org.freedesktop.udisks2.filesystem-mount-other-seat;org.freedesktop.udisks2.filesystem-mount-options;org.freedesktop.udisks2.filesystem-unmount-others;org.freedesktop.udisks2.loop-setup;org.freedesktop.udisks2.change-system-power;org.freedesktop.udisks2.authorize
      ResultActive=no
      
      Note: This rule might prevent users from mounting their own USB drives. If you want to allow them to mount their own removable media, you'll need a more nuanced rule, potentially leveraging ResultActive=auth_self or modifying Identity to exclude udisks-internal actions for own. For a server where data integrity is paramount, outright denial for non-admins is often safer.

    7. Printing & Printer Configuration

    • Problem: Users can add/remove printers, change default settings, or pause print queues for others.
    • Restriction: Deny CUPS (Common Unix Printing System) administration.
    • File: /etc/polkit-1/localauthority/50-local.d/07-no-printer-config.pkla
    • Content:
      [Disable Printer Configuration for Users]
      Identity=unix-group:users;!unix-group:sudo
      Action=org.cups.cupsd.admin;org.cups.cupsd.set-default;org.cups.cupsd.print;org.cups.cupsd.shutdown
      ResultActive=no
      
      Note: org.cups.cupsd.print is included. This means they cannot print at all. If you want them to be able to print to existing printers, remove org.cups.cupsd.print from the Action line.

    8. Global Display Settings / Monitor Configuration

    • Problem: A user changing resolution or monitor setup could affect other users' sessions or the server console.
    • Restriction: With xrdp providing separate X sessions, each user generally manages their own virtual display resolution within their session, which doesn't affect others. However, if they gain access to lightdm or gdm global configurations or tools like xrandr without specifying display, it could be an issue.
    • Solution: PolicyKit rules for org.gnome.control-center.user-accounts related to display are not directly applicable to global changes in separate xrdp sessions. The primary protection here is the session isolation provided by xrdp. If you're using a single shared X session (e.g., multiple VNC viewers connecting to DISPLAY=:0), this would be a much bigger concern, but xrdp avoids this. No specific .pkla needed here unless you identify a specific vector.

    General Best Practices for a Multi-User Server

    Beyond specific components, consider these:

    1. Strong Passwords: Enforce complex passwords for all users.
    2. SSH Key-based Authentication: For administrative access via SSH, disable password authentication and use SSH keys.
    3. Firewall (UFW): Configure ufw to only allow necessary incoming connections (e.g., SSH on port 22, RDP on port 3389).
      sudo ufw default deny incoming
      sudo ufw default allow outgoing
      sudo ufw allow ssh
      sudo ufw allow 3389/tcp # For RDP
      sudo ufw enable
      
    4. Regular Updates: As the administrator, keep the system updated: sudo apt update && sudo apt upgrade.
    5. Log Monitoring: Regularly check /var/log/auth.log, syslog, and journalctl for suspicious activity.
    6. Fail2Ban: Install fail2ban to protect SSH and RDP from brute-force attacks.
    7. Disable Guest Account: If you're using LightDM, ensure the guest session is disabled.
    8. AppArmor/SELinux (Advanced): For extreme security, you could explore mandatory access control systems like AppArmor or SELinux, but this is a complex topic beyond the scope of initial setup and often overkill for a typical shared desktop server.
    9. No sudo for Users: Reiterate: Never give sudo access to normal users.

    Testing Your Configuration

    After implementing these .pkla files and restarting polkit.service, log in as a normal (non-sudo) user via xrdp. Systematically try to:

    • Shut down or restart the computer (e.g., from the Cinnamon menu).
    • Open Network Settings and try to change IP, DNS, or add a connection.
    • Open Users and Groups and try to create or modify users.
    • Open the Software Center and try to install/remove software.
    • Change the system time or date.
    • Mount/unmount a USB drive (if applicable).
    • Add a new printer.

    You should either see the options greyed out, or a password prompt that doesn't accept the user's password (and requires an admin password).


    This comprehensive approach should give you a secure and stable multi-user remote desktop environment on Ubuntu with Cinnamon, where administrators retain full control, and normal users are appropriately restricted. Remember to test thoroughly after each change!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.