Remote multi-user access and windows+ubuntu dual system soft switching


A few days ago, I encountered a computer that needs multiple people to use the graphical interface at the same time, and there is a need for dual system use. After searching and practicing, I found that it is feasible. This article introduces the method of allowing multiple people to use the same computer remotely without affecting each other, and the method of dual-system software level switching.

Windows and Ubuntu dual system soft switching

When remotely connecting Windows and Ubuntu dual-system computers, sometimes it is necessary to remotely switch the two systems, but it is impossible to remotely select the system to start in the BIOS. This article provides a reliable solution to reboot to another system on the premise of entering a certain system in advance.
First of all, if the dual system is installed normally, install Windows first, and then install Ubuntu, then Ubuntu will become the boot of the BIOS, and the interface for selecting the startup system should look like this.

UbuntuSwitch to Windows

In the file /etc/default/grub, you can modify the BIOS default selection to start the system by modifying the value of GRUB_DEFAULT=0. But if it is set to start the Windows system by default (the value is modified to 2), you cannot switch back to Ubuntu from Windows.
Therefore, you can specify to restart to the Windows system through the bash command, but it does not affect the default selection of the BIOS.

sudo grub-reboot 2 #指定选择Windows系统
sudo reboot

For speed and convenience, you can create a shortcut on the desktop and write an executable script to achieve restart.
Create Shortcut

Create and edit the .desktop file on the desktop. The content of the file is as follows.

[Desktop Entry]
Encoding=UTF-8
Name=Reboot to Windows
Icon=help-about
Exec=bash /home/你的.sh文件绝对路径
Type=Application
Terminal=false

.sh file

echo "你的sudo密码" | sudo -S grub-reboot 2
echo "你的sudo密码" | sudo -S reboot

There is no shell script setting method for the restart waiting time, you can directly modify the grub file, GRUB_TIMEOUT corresponds to the waiting time, and you can modify it to an acceptable level.

sudo gedit /etc/default/grub

image-20221119093433745

Switch from Windows to Ubuntu

Restart directly, the BIOS default selection system is Ubuntu.

Simultaneous use by multiple users under Ubuntu

Use xrdp to configure multi-user remote desktop under ubuntu, and use rdp under windows. Considering that the ubuntu server version does not have its own desktop environment, you can install the desktop environment on demand.

Install desktop environment Xfce

  • Install Xfce
sudo apt update
sudo apt-get upgrade
sudo apt install xubuntu-desktop

Introduction to xrdp

Xrdp is an open source implementation of Microsoft's Remote Desktop Protocol (RDP) that allows graphical control of remote systems. Using RDP, you can log in to a remote computer and create a true desktop session just as if you were logged in to your local computer. This blog post uses the xrdp installer script as an example to install the service. The xRDP installer script simplifies the installation of the xRDP package on an Ubuntu machine. The xRDP installer script performs additional post-configuration actions to provide the best remote desktop user experience. These scripts are built specifically for standard Ubuntu distributions.

install xrdp

sudo apt install xrdp

Once the installation is complete, the Xrdp service will start automatically. Enter the following command to verify whether xrdp is started successfully.

sudo systemctl status xrdp

insert image description here

set root user

Xrdp remote connection must use root user. If you have not used the root user, first set the root password.

sudo passwd root

For multi-user use, create a new user and grant root privileges.

1. Switch to the root user

sudo su

2. Add a new user

useradd frontng

3. Set a password for this user

passwd frontng

Prompt for password vim

Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

4. Give root permission

vim /etc/sudoers

Modify the file as follows: bash

# User privilege specification
root ALL=(ALL) ALL
frontng ALL=(ALL) AL

5. Set the user's home directory

usermod -d /home/frontng frontng

6. Set the user's default command interpreter (usually bash)

usermod -s /bin/bash frontng

connect to xrdp server

Type "Remote Desktop Connection" in the Windows search bar

Then enter the public network IP address and user name of ubuntu, note that you need to have root authority, and click "Connect". After entering, enter the corresponding password to successfully connect.

insert image description here

image-20221119100447933

some problems

Using Xface for remote desktop connection may encounter a blue screen or the situation that the mouse and keyboard cannot be used. If you are stuck in windows remote connection, first check whether the computer's IP address and user name are correct.

blue screen

wget http://www.c-nergy.be/downloads/install-xrdp-3.0.zip
unzip install-xrdp-3.0.zip
chmod 777 Install-xrdp-3.0.sh
./Install-xrdp-3.0.sh
最后重启机器 sudo shutdown -r now

Restoring from the Xubuntu desktop system to the Ubuntu system

The user version ubuntu system has its own desktop environment. If you have installed Xfce and want to return to the original desktop environment, the parts that need to be changed are

  • switch animation
  • login interface

The main change process is as follows:

1. Delete the original xubuntu desktop system and configuration files :

sudo apt-get remove --purge xfce4*



sudo apt-get remove --purge xubuntu*

2. Change the boot animation:

sudo update-alternatives --config default.plymouth

The following options will appear:

img

Select the option corresponding to ubuntu-logo.plymouth, for example, select 2 here, and press Enter.

3. Change the login interface

Enter the following command to restore the original login interface:

sudo apt purge lightdm-gtk-greeter lightdm-gtk-greeter-settings



sudo systemctl restart lightdm

After these three steps, the xubuntu desktop system can be restored to the ubuntu desktop system.

Solution to Ubuntu keyboard and mouse failure

Select Advanced Options on the boot interface, select the option with (Recovery mode); then select Network and click yes; continue to select Drop to root shell prompt, and click "Enter"; enter mount -o rw, remount /; then enter apt install xserver-xorg-input-all (here to ensure that the computer network).
Wait for the installation and configuration to complete, and enter sudo reboot to restart.

reference link

Ubuntu+Windows dual system remote restart and switch between each other

Ubuntu Server 18.04 installs remote desktop and connects

Ubuntu adds a new user and grants root privileges

Use XRDP remote desktop login blue screen solution on UBUNTU 18.04 (including flashback)

Solution to Ubuntu keyboard and mouse failure

How to restore from Xubuntu desktop system to Ubuntu system?

Guess you like

Origin blog.csdn.net/qq_37214693/article/details/127939881