mirror of
https://github.com/rustdesk/doc.rustdesk.com.git
synced 2026-04-08 16:56:28 +00:00
full translation
This commit is contained in:
376
content/self-host/client-deployment/_index.es.md
Normal file
376
content/self-host/client-deployment/_index.es.md
Normal file
@@ -0,0 +1,376 @@
|
||||
---
|
||||
title: Despliegue de Cliente
|
||||
weight: 400
|
||||
pre: "<b>2.4. </b>"
|
||||
---
|
||||
|
||||
La forma más simple es usar un cliente personalizado, https://twitter.com/rustdesk/status/1788905463678951787.
|
||||
|
||||
Puedes desplegar usando varios métodos, algunos están cubiertos en [Configuración del Cliente](https://rustdesk.com/docs/en/self-host/client-configuration/).
|
||||
|
||||
Alternativamente, puedes usar scripts de despliegue masivo con tu RMM, Intune, etc. El ID y la contraseña son outputados por el script. Deberías recopilar esto o dividirlo en diferentes scripts para recopilar el ID y la contraseña.
|
||||
|
||||
La contraseña permanente puede cambiarse de aleatoria a una que prefieras modificando el contenido dentro de `()` después de `rustdesk_pw` a tu contraseña preferida para PowerShell y la línea correspondiente para cualquier otra plataforma.
|
||||
|
||||
### PowerShell
|
||||
|
||||
```powershell
|
||||
$ErrorActionPreference= 'silentlycontinue'
|
||||
|
||||
# Asignar el valor de contraseña aleatoria a la variable contraseña
|
||||
$rustdesk_pw=(-join ((65..90) + (97..122) | Get-Random -Count 12 | % {[char]$_}))
|
||||
|
||||
# Obtener tu cadena de configuración desde tu portal Web y rellenar abajo
|
||||
$rustdesk_cfg="configstring"
|
||||
|
||||
################################### Por favor no edites debajo de esta línea #########################################
|
||||
|
||||
# Ejecutar como administrador y permanecer en el directorio actual
|
||||
if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
|
||||
{
|
||||
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000)
|
||||
{
|
||||
Start-Process PowerShell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";
|
||||
Exit;
|
||||
}
|
||||
}
|
||||
|
||||
# Esta función devolverá la última versión y enlace de descarga como un objeto
|
||||
function getLatest()
|
||||
{
|
||||
$Page = Invoke-WebRequest -Uri 'https://github.com/rustdesk/rustdesk/releases/latest' -UseBasicParsing
|
||||
$HTML = New-Object -Com "HTMLFile"
|
||||
try
|
||||
{
|
||||
$HTML.IHTMLDocument2_write($Page.Content)
|
||||
}
|
||||
catch
|
||||
{
|
||||
$src = [System.Text.Encoding]::Unicode.GetBytes($Page.Content)
|
||||
$HTML.write($src)
|
||||
}
|
||||
|
||||
# Enlace de ejemplo actual: https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.exe
|
||||
$Downloadlink = ($HTML.Links | Where {$_.href -match '(.)+\/rustdesk\/rustdesk\/releases\/download\/\d{1}.\d{1,2}.\d{1,2}(.{0,3})\/rustdesk(.)+x86_64.exe'} | select -first 1).href
|
||||
|
||||
# corrección de bug - a veces necesitas reemplazar "about:"
|
||||
$Downloadlink = $Downloadlink.Replace('about:', 'https://github.com')
|
||||
|
||||
$Version = "unknown"
|
||||
if ($Downloadlink -match './rustdesk/rustdesk/releases/download/(?<content>.*)/rustdesk-(.)+x86_64.exe')
|
||||
{
|
||||
$Version = $matches['content']
|
||||
}
|
||||
|
||||
if ($Version -eq "unknown" -or $Downloadlink -eq "")
|
||||
{
|
||||
Write-Output "ERROR: Versión o enlace de descarga no encontrado."
|
||||
Exit
|
||||
}
|
||||
|
||||
# Crear objeto para devolver
|
||||
$params += @{Version = $Version}
|
||||
$params += @{Downloadlink = $Downloadlink}
|
||||
$Result = New-Object PSObject -Property $params
|
||||
|
||||
return($Result)
|
||||
}
|
||||
|
||||
$RustDeskOnGitHub = getLatest
|
||||
|
||||
|
||||
$rdver = ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RustDesk\").Version)
|
||||
|
||||
if ($rdver -eq $RustDeskOnGitHub.Version)
|
||||
{
|
||||
Write-Output "RustDesk $rdver es la versión más reciente."
|
||||
Exit
|
||||
}
|
||||
|
||||
if (!(Test-Path C:\Temp))
|
||||
{
|
||||
New-Item -ItemType Directory -Force -Path C:\Temp | Out-Null
|
||||
}
|
||||
|
||||
cd C:\Temp
|
||||
|
||||
Invoke-WebRequest $RustDeskOnGitHub.Downloadlink -Outfile "rustdesk.exe"
|
||||
Start-Process .\rustdesk.exe --silent-install
|
||||
Start-Sleep -seconds 20
|
||||
|
||||
$ServiceName = 'Rustdesk'
|
||||
$arrService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
|
||||
|
||||
if ($arrService -eq $null)
|
||||
{
|
||||
Write-Output "Instalando servicio"
|
||||
cd $env:ProgramFiles\RustDesk
|
||||
Start-Process .\rustdesk.exe --install-service
|
||||
Start-Sleep -seconds 20
|
||||
$arrService = Get-Service -Name $ServiceName
|
||||
}
|
||||
|
||||
while ($arrService.Status -ne 'Running')
|
||||
{
|
||||
Start-Service $ServiceName
|
||||
Start-Sleep -seconds 5
|
||||
$arrService.Refresh()
|
||||
}
|
||||
|
||||
cd $env:ProgramFiles\RustDesk\
|
||||
.\rustdesk.exe --get-id | Write-Output -OutVariable rustdesk_id
|
||||
|
||||
.\rustdesk.exe --config $rustdesk_cfg
|
||||
|
||||
.\rustdesk.exe --password $rustdesk_pw
|
||||
|
||||
Write-Output "..............................................."
|
||||
# Mostrar el valor de la variable ID
|
||||
Write-Output "ID RustDesk: $rustdesk_id"
|
||||
|
||||
# Mostrar el valor de la variable contraseña
|
||||
Write-Output "Contraseña: $rustdesk_pw"
|
||||
Write-Output "..............................................."
|
||||
```
|
||||
|
||||
### Windows batch/cmd
|
||||
|
||||
```bat
|
||||
@echo off
|
||||
|
||||
REM Asignar el valor de contraseña aleatoria a la variable contraseña
|
||||
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
|
||||
set alfanum=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
|
||||
set rustdesk_pw=
|
||||
for /L %%b in (1, 1, 12) do (
|
||||
set /A rnd_num=!RANDOM! %% 62
|
||||
for %%c in (!rnd_num!) do (
|
||||
set rustdesk_pw=!rustdesk_pw!!alfanum:~%%c,1!
|
||||
)
|
||||
)
|
||||
|
||||
REM Obtener tu cadena de configuración desde tu portal Web y rellenar abajo
|
||||
set rustdesk_cfg="configstring"
|
||||
|
||||
REM ############################### Por favor no edites debajo de esta línea #########################################
|
||||
|
||||
if not exist C:\Temp\ md C:\Temp\
|
||||
cd C:\Temp\
|
||||
|
||||
curl -L "https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.exe" -o rustdesk.exe
|
||||
|
||||
rustdesk.exe --silent-install
|
||||
timeout /t 20
|
||||
|
||||
cd "C:\Program Files\RustDesk\"
|
||||
rustdesk.exe --install-service
|
||||
timeout /t 20
|
||||
|
||||
for /f "delims=" %%i in ('rustdesk.exe --get-id ^| more') do set rustdesk_id=%%i
|
||||
|
||||
rustdesk.exe --config %rustdesk_cfg%
|
||||
|
||||
rustdesk.exe --password %rustdesk_pw%
|
||||
|
||||
echo ...............................................
|
||||
REM Mostrar el valor de la variable ID
|
||||
echo ID RustDesk: %rustdesk_id%
|
||||
|
||||
REM Mostrar el valor de la variable contraseña
|
||||
echo Contraseña: %rustdesk_pw%
|
||||
echo ...............................................
|
||||
```
|
||||
|
||||
### MSI
|
||||
|
||||
También puedes usar msi en lugar de `rustdesk.exe --silent-install`.
|
||||
|
||||
https://rustdesk.com/docs/en/client/windows/msi/
|
||||
|
||||
|
||||
### Winget
|
||||
|
||||
puedes desplegar vía powershell con winget también (esto instala vía la versión de Microsoft de apt - parte de las instalaciones de Windows más recientes)
|
||||
|
||||
desde una ventana de powershell o vía script (por ejemplo vía GPO)
|
||||
|
||||
```
|
||||
winget install --id=RustDesk.RustDesk -e
|
||||
```
|
||||
|
||||
### macOS Bash
|
||||
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# Asignar el valor de contraseña aleatoria a la variable contraseña
|
||||
rustdesk_pw=$(openssl rand -hex 4)
|
||||
|
||||
# Obtener tu cadena de configuración desde tu portal Web y rellenar abajo
|
||||
rustdesk_cfg="configstring"
|
||||
|
||||
################################### Por favor no edites debajo de esta línea #########################################
|
||||
|
||||
# Solicitud de contraseña de root para elevación de privilegios
|
||||
[ "$UID" -eq 0 ] || exec sudo bash "$0" "$@"
|
||||
|
||||
# Especificar el punto de montaje para el DMG (directorio temporal)
|
||||
mount_point="/Volumes/RustDesk"
|
||||
|
||||
# Descargar el archivo rustdesk.dmg
|
||||
echo "Descargando RustDesk ahora"
|
||||
|
||||
if [[ $(arch) == 'arm64' ]]; then
|
||||
rd_link=$(curl -sL https://github.com/rustdesk/rustdesk/releases/latest | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*/\d{1}.\d{1,2}.\d{1,2}/rustdesk.\d{1}.\d{1,2}.\d{1,2}.aarch64.dmg")
|
||||
dmg_file=$(echo $rd_link | grep -Eo "rustdesk.\d{1}.\d{1,2}.\d{1,2}.aarch64.dmg")
|
||||
curl -L "$rd_link" --output "$dmg_file"
|
||||
else
|
||||
rd_link=$(curl -sL https://github.com/rustdesk/rustdesk/releases/latest | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*/\d{1}.\d{1,2}.\d{1,2}/rustdesk.\d{1}.\d{1,2}.\d{1,2}.x86_64.dmg")
|
||||
dmg_file=$(echo $rd_link | grep -Eo "rustdesk.\d{1}.\d{1,2}.\d{1,2}.x86_64.dmg")
|
||||
curl -L "$rd_link" --output "$dmg_file"
|
||||
fi
|
||||
|
||||
# Montar el archivo DMG en el punto de montaje especificado
|
||||
hdiutil attach "$dmg_file" -mountpoint "$mount_point" &> /dev/null
|
||||
|
||||
# Verificar si el montaje fue exitoso
|
||||
if [ $? -eq 0 ]; then
|
||||
# Mover el contenido del DMG montado a la carpeta /Applications
|
||||
cp -R "$mount_point/RustDesk.app" "/Applications/" &> /dev/null
|
||||
|
||||
# Desmontar el archivo DMG
|
||||
hdiutil detach "$mount_point" &> /dev/null
|
||||
else
|
||||
echo "Error al montar el DMG de RustDesk. Instalación abortada."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ejecutar el comando rustdesk con --get-id y almacenar la salida en la variable rustdesk_id
|
||||
cd /Applications/RustDesk.app/Contents/MacOS/
|
||||
rustdesk_id=$(./RustDesk --get-id)
|
||||
|
||||
# Aplicar nueva contraseña a RustDesk
|
||||
./RustDesk --server &
|
||||
/Applications/RustDesk.app/Contents/MacOS/RustDesk --password $rustdesk_pw &> /dev/null
|
||||
|
||||
/Applications/RustDesk.app/Contents/MacOS/RustDesk --config $rustdesk_cfg
|
||||
|
||||
# Matar todos los procesos llamados RustDesk
|
||||
rdpid=$(pgrep RustDesk)
|
||||
kill $rdpid &> /dev/null
|
||||
|
||||
echo "..............................................."
|
||||
# Verificar si rustdesk_id no está vacío
|
||||
if [ -n "$rustdesk_id" ]; then
|
||||
echo "ID RustDesk: $rustdesk_id"
|
||||
else
|
||||
echo "Error al obtener el ID de RustDesk."
|
||||
fi
|
||||
|
||||
# Mostrar el valor de la variable contraseña
|
||||
echo "Contraseña: $rustdesk_pw"
|
||||
echo "..............................................."
|
||||
|
||||
echo "Por favor completa la instalación en GUI, lanzando RustDesk ahora."
|
||||
open -n /Applications/RustDesk.app
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# Asignar un valor aleatorio a la variable contraseña
|
||||
rustdesk_pw=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)
|
||||
|
||||
# Obtener tu cadena de configuración desde tu portal Web y rellenar abajo
|
||||
rustdesk_cfg="configstring"
|
||||
|
||||
################################### Por favor no edites debajo de esta línea #########################################
|
||||
|
||||
# Verificar si el script se está ejecutando como root
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Este script debe ejecutarse como root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Identificar OS
|
||||
if [ -f /etc/os-release ]; then
|
||||
# freedesktop.org y systemd
|
||||
. /etc/os-release
|
||||
OS=$NAME
|
||||
VER=$VERSION_ID
|
||||
|
||||
UPSTREAM_ID=${ID_LIKE,,}
|
||||
|
||||
# Recurrir a ID_LIKE si ID no era 'ubuntu' o 'debian'
|
||||
if [ "${UPSTREAM_ID}" != "debian" ] && [ "${UPSTREAM_ID}" != "ubuntu" ]; then
|
||||
UPSTREAM_ID="$(echo ${ID_LIKE,,} | sed s/\"//g | cut -d' ' -f1)"
|
||||
fi
|
||||
|
||||
elif type lsb_release >/dev/null 2>&1; then
|
||||
# linuxbase.org
|
||||
OS=$(lsb_release -si)
|
||||
VER=$(lsb_release -sr)
|
||||
elif [ -f /etc/lsb-release ]; then
|
||||
# Para algunas versiones de Debian/Ubuntu sin el comando lsb_release
|
||||
. /etc/lsb-release
|
||||
OS=$DISTRIB_ID
|
||||
VER=$DISTRIB_RELEASE
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
# Debian más antiguo, Ubuntu, etc.
|
||||
OS=Debian
|
||||
VER=$(cat /etc/debian_version)
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
# SuSE más antiguo etc.
|
||||
OS=SuSE
|
||||
VER=$(cat /etc/SuSE-release)
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
# Red Hat más antiguo, CentOS, etc.
|
||||
OS=RedHat
|
||||
VER=$(cat /etc/redhat-release)
|
||||
else
|
||||
# Recurrir a uname, ej. "Linux <version>", también funciona para BSD, etc.
|
||||
OS=$(uname -s)
|
||||
VER=$(uname -r)
|
||||
fi
|
||||
|
||||
# Instalar RustDesk
|
||||
|
||||
echo "Instalando RustDesk"
|
||||
if [ "${ID}" = "debian" ] || [ "$OS" = "Ubuntu" ] || [ "$OS" = "Debian" ] || [ "${UPSTREAM_ID}" = "ubuntu" ] || [ "${UPSTREAM_ID}" = "debian" ]; then
|
||||
wget https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.deb
|
||||
apt-get install -fy ./rustdesk-1.2.6-x86_64.deb > null
|
||||
elif [ "$OS" = "CentOS" ] || [ "$OS" = "RedHat" ] || [ "$OS" = "Fedora Linux" ] || [ "${UPSTREAM_ID}" = "rhel" ] || [ "$OS" = "Almalinux" ] || [ "$OS" = "Rocky*" ] ; then
|
||||
wget https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-0.x86_64.rpm
|
||||
yum localinstall ./rustdesk-1.2.6-0.x86_64.rpm -y > null
|
||||
else
|
||||
echo "OS no soportado"
|
||||
# aquí podrías preguntar al usuario por permiso para intentar instalar de todos modos
|
||||
# si dicen sí, entonces hacer la instalación
|
||||
# si dicen no, salir del script
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ejecutar el comando rustdesk con --get-id y almacenar la salida en la variable rustdesk_id
|
||||
rustdesk_id=$(rustdesk --get-id)
|
||||
|
||||
# Aplicar nueva contraseña a RustDesk
|
||||
rustdesk --password $rustdesk_pw &> /dev/null
|
||||
|
||||
rustdesk --config $rustdesk_cfg
|
||||
|
||||
systemctl restart rustdesk
|
||||
|
||||
echo "..............................................."
|
||||
# Verificar si rustdesk_id no está vacío
|
||||
if [ -n "$rustdesk_id" ]; then
|
||||
echo "ID RustDesk: $rustdesk_id"
|
||||
else
|
||||
echo "Error al obtener el ID de RustDesk."
|
||||
fi
|
||||
|
||||
# Mostrar el valor de la variable contraseña
|
||||
echo "Contraseña: $rustdesk_pw"
|
||||
echo "..............................................."
|
||||
```
|
||||
376
content/self-host/client-deployment/_index.fr.md
Normal file
376
content/self-host/client-deployment/_index.fr.md
Normal file
@@ -0,0 +1,376 @@
|
||||
---
|
||||
title: Déploiement Client
|
||||
weight: 400
|
||||
pre: "<b>2.4. </b>"
|
||||
---
|
||||
|
||||
La méthode la plus simple est d'utiliser un client personnalisé, https://twitter.com/rustdesk/status/1788905463678951787.
|
||||
|
||||
Vous pouvez déployer en utilisant plusieurs méthodes, dont certaines sont couvertes dans [Configuration Client](https://rustdesk.com/docs/en/self-host/client-configuration/).
|
||||
|
||||
Alternativement, vous pouvez utiliser des scripts de déploiement de masse avec votre RMM, Intune, etc. L'ID et le mot de passe sont sortis par le script. Vous devriez collecter cela ou le diviser en différents scripts pour collecter l'ID et le mot de passe.
|
||||
|
||||
Le mot de passe permanent peut être changé d'aléatoire à celui que vous préférez en modifiant le contenu entre `()` après `rustdesk_pw` vers votre mot de passe préféré pour PowerShell et la ligne correspondante pour toute autre plateforme.
|
||||
|
||||
### PowerShell
|
||||
|
||||
```powershell
|
||||
$ErrorActionPreference= 'silentlycontinue'
|
||||
|
||||
# Assigner la valeur du mot de passe aléatoire à la variable mot de passe
|
||||
$rustdesk_pw=(-join ((65..90) + (97..122) | Get-Random -Count 12 | % {[char]$_}))
|
||||
|
||||
# Obtenez votre chaîne de config depuis votre portail Web et remplissez ci-dessous
|
||||
$rustdesk_cfg="configstring"
|
||||
|
||||
################################### Veuillez ne pas modifier en dessous de cette ligne #########################################
|
||||
|
||||
# Exécuter en tant qu'administrateur et rester dans le répertoire courant
|
||||
if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
|
||||
{
|
||||
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000)
|
||||
{
|
||||
Start-Process PowerShell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";
|
||||
Exit;
|
||||
}
|
||||
}
|
||||
|
||||
# Cette fonction retournera la dernière version et le lien de téléchargement comme un objet
|
||||
function getLatest()
|
||||
{
|
||||
$Page = Invoke-WebRequest -Uri 'https://github.com/rustdesk/rustdesk/releases/latest' -UseBasicParsing
|
||||
$HTML = New-Object -Com "HTMLFile"
|
||||
try
|
||||
{
|
||||
$HTML.IHTMLDocument2_write($Page.Content)
|
||||
}
|
||||
catch
|
||||
{
|
||||
$src = [System.Text.Encoding]::Unicode.GetBytes($Page.Content)
|
||||
$HTML.write($src)
|
||||
}
|
||||
|
||||
# Lien d'exemple actuel : https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.exe
|
||||
$Downloadlink = ($HTML.Links | Where {$_.href -match '(.)+\/rustdesk\/rustdesk\/releases\/download\/\d{1}.\d{1,2}.\d{1,2}(.{0,3})\/rustdesk(.)+x86_64.exe'} | select -first 1).href
|
||||
|
||||
# correction de bug - parfois vous devez remplacer "about:"
|
||||
$Downloadlink = $Downloadlink.Replace('about:', 'https://github.com')
|
||||
|
||||
$Version = "unknown"
|
||||
if ($Downloadlink -match './rustdesk/rustdesk/releases/download/(?<content>.*)/rustdesk-(.)+x86_64.exe')
|
||||
{
|
||||
$Version = $matches['content']
|
||||
}
|
||||
|
||||
if ($Version -eq "unknown" -or $Downloadlink -eq "")
|
||||
{
|
||||
Write-Output "ERREUR : Version ou lien de téléchargement non trouvé."
|
||||
Exit
|
||||
}
|
||||
|
||||
# Créer un objet à retourner
|
||||
$params += @{Version = $Version}
|
||||
$params += @{Downloadlink = $Downloadlink}
|
||||
$Result = New-Object PSObject -Property $params
|
||||
|
||||
return($Result)
|
||||
}
|
||||
|
||||
$RustDeskOnGitHub = getLatest
|
||||
|
||||
|
||||
$rdver = ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RustDesk\").Version)
|
||||
|
||||
if ($rdver -eq $RustDeskOnGitHub.Version)
|
||||
{
|
||||
Write-Output "RustDesk $rdver est la version la plus récente."
|
||||
Exit
|
||||
}
|
||||
|
||||
if (!(Test-Path C:\Temp))
|
||||
{
|
||||
New-Item -ItemType Directory -Force -Path C:\Temp | Out-Null
|
||||
}
|
||||
|
||||
cd C:\Temp
|
||||
|
||||
Invoke-WebRequest $RustDeskOnGitHub.Downloadlink -Outfile "rustdesk.exe"
|
||||
Start-Process .\rustdesk.exe --silent-install
|
||||
Start-Sleep -seconds 20
|
||||
|
||||
$ServiceName = 'Rustdesk'
|
||||
$arrService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
|
||||
|
||||
if ($arrService -eq $null)
|
||||
{
|
||||
Write-Output "Installation du service"
|
||||
cd $env:ProgramFiles\RustDesk
|
||||
Start-Process .\rustdesk.exe --install-service
|
||||
Start-Sleep -seconds 20
|
||||
$arrService = Get-Service -Name $ServiceName
|
||||
}
|
||||
|
||||
while ($arrService.Status -ne 'Running')
|
||||
{
|
||||
Start-Service $ServiceName
|
||||
Start-Sleep -seconds 5
|
||||
$arrService.Refresh()
|
||||
}
|
||||
|
||||
cd $env:ProgramFiles\RustDesk\
|
||||
.\rustdesk.exe --get-id | Write-Output -OutVariable rustdesk_id
|
||||
|
||||
.\rustdesk.exe --config $rustdesk_cfg
|
||||
|
||||
.\rustdesk.exe --password $rustdesk_pw
|
||||
|
||||
Write-Output "..............................................."
|
||||
# Afficher la valeur de la variable ID
|
||||
Write-Output "ID RustDesk : $rustdesk_id"
|
||||
|
||||
# Afficher la valeur de la variable mot de passe
|
||||
Write-Output "Mot de passe : $rustdesk_pw"
|
||||
Write-Output "..............................................."
|
||||
```
|
||||
|
||||
### Windows batch/cmd
|
||||
|
||||
```bat
|
||||
@echo off
|
||||
|
||||
REM Assigner la valeur du mot de passe aléatoire à la variable mot de passe
|
||||
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
|
||||
set alfanum=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
|
||||
set rustdesk_pw=
|
||||
for /L %%b in (1, 1, 12) do (
|
||||
set /A rnd_num=!RANDOM! %% 62
|
||||
for %%c in (!rnd_num!) do (
|
||||
set rustdesk_pw=!rustdesk_pw!!alfanum:~%%c,1!
|
||||
)
|
||||
)
|
||||
|
||||
REM Obtenez votre chaîne de config depuis votre portail Web et remplissez ci-dessous
|
||||
set rustdesk_cfg="configstring"
|
||||
|
||||
REM ############################### Veuillez ne pas modifier en dessous de cette ligne #########################################
|
||||
|
||||
if not exist C:\Temp\ md C:\Temp\
|
||||
cd C:\Temp\
|
||||
|
||||
curl -L "https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.exe" -o rustdesk.exe
|
||||
|
||||
rustdesk.exe --silent-install
|
||||
timeout /t 20
|
||||
|
||||
cd "C:\Program Files\RustDesk\"
|
||||
rustdesk.exe --install-service
|
||||
timeout /t 20
|
||||
|
||||
for /f "delims=" %%i in ('rustdesk.exe --get-id ^| more') do set rustdesk_id=%%i
|
||||
|
||||
rustdesk.exe --config %rustdesk_cfg%
|
||||
|
||||
rustdesk.exe --password %rustdesk_pw%
|
||||
|
||||
echo ...............................................
|
||||
REM Afficher la valeur de la variable ID
|
||||
echo ID RustDesk : %rustdesk_id%
|
||||
|
||||
REM Afficher la valeur de la variable mot de passe
|
||||
echo Mot de passe : %rustdesk_pw%
|
||||
echo ...............................................
|
||||
```
|
||||
|
||||
### MSI
|
||||
|
||||
Vous pouvez aussi utiliser msi au lieu de `rustdesk.exe --silent-install`.
|
||||
|
||||
https://rustdesk.com/docs/en/client/windows/msi/
|
||||
|
||||
|
||||
### Winget
|
||||
|
||||
vous pouvez déployer via powershell avec winget également (cela s'installe via la version Microsoft d'apt - partie des installations Windows les plus récentes)
|
||||
|
||||
depuis une fenêtre powershell ou via un script (par exemple via GPO)
|
||||
|
||||
```
|
||||
winget install --id=RustDesk.RustDesk -e
|
||||
```
|
||||
|
||||
### macOS Bash
|
||||
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# Assigner la valeur du mot de passe aléatoire à la variable mot de passe
|
||||
rustdesk_pw=$(openssl rand -hex 4)
|
||||
|
||||
# Obtenez votre chaîne de config depuis votre portail Web et remplissez ci-dessous
|
||||
rustdesk_cfg="configstring"
|
||||
|
||||
################################### Veuillez ne pas modifier en dessous de cette ligne #########################################
|
||||
|
||||
# Demande de mot de passe root pour l'élévation de privilège
|
||||
[ "$UID" -eq 0 ] || exec sudo bash "$0" "$@"
|
||||
|
||||
# Spécifier le point de montage pour le DMG (répertoire temporaire)
|
||||
mount_point="/Volumes/RustDesk"
|
||||
|
||||
# Télécharger le fichier rustdesk.dmg
|
||||
echo "Téléchargement de RustDesk maintenant"
|
||||
|
||||
if [[ $(arch) == 'arm64' ]]; then
|
||||
rd_link=$(curl -sL https://github.com/rustdesk/rustdesk/releases/latest | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*/\d{1}.\d{1,2}.\d{1,2}/rustdesk.\d{1}.\d{1,2}.\d{1,2}.aarch64.dmg")
|
||||
dmg_file=$(echo $rd_link | grep -Eo "rustdesk.\d{1}.\d{1,2}.\d{1,2}.aarch64.dmg")
|
||||
curl -L "$rd_link" --output "$dmg_file"
|
||||
else
|
||||
rd_link=$(curl -sL https://github.com/rustdesk/rustdesk/releases/latest | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*/\d{1}.\d{1,2}.\d{1,2}/rustdesk.\d{1}.\d{1,2}.\d{1,2}.x86_64.dmg")
|
||||
dmg_file=$(echo $rd_link | grep -Eo "rustdesk.\d{1}.\d{1,2}.\d{1,2}.x86_64.dmg")
|
||||
curl -L "$rd_link" --output "$dmg_file"
|
||||
fi
|
||||
|
||||
# Monter le fichier DMG au point de montage spécifié
|
||||
hdiutil attach "$dmg_file" -mountpoint "$mount_point" &> /dev/null
|
||||
|
||||
# Vérifier si le montage a réussi
|
||||
if [ $? -eq 0 ]; then
|
||||
# Déplacer le contenu du DMG monté vers le dossier /Applications
|
||||
cp -R "$mount_point/RustDesk.app" "/Applications/" &> /dev/null
|
||||
|
||||
# Démonter le fichier DMG
|
||||
hdiutil detach "$mount_point" &> /dev/null
|
||||
else
|
||||
echo "Échec du montage du DMG RustDesk. Installation abandonnée."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Exécuter la commande rustdesk avec --get-id et stocker la sortie dans la variable rustdesk_id
|
||||
cd /Applications/RustDesk.app/Contents/MacOS/
|
||||
rustdesk_id=$(./RustDesk --get-id)
|
||||
|
||||
# Appliquer le nouveau mot de passe à RustDesk
|
||||
./RustDesk --server &
|
||||
/Applications/RustDesk.app/Contents/MacOS/RustDesk --password $rustdesk_pw &> /dev/null
|
||||
|
||||
/Applications/RustDesk.app/Contents/MacOS/RustDesk --config $rustdesk_cfg
|
||||
|
||||
# Tuer tous les processus nommés RustDesk
|
||||
rdpid=$(pgrep RustDesk)
|
||||
kill $rdpid &> /dev/null
|
||||
|
||||
echo "..............................................."
|
||||
# Vérifier si rustdesk_id n'est pas vide
|
||||
if [ -n "$rustdesk_id" ]; then
|
||||
echo "ID RustDesk : $rustdesk_id"
|
||||
else
|
||||
echo "Échec de l'obtention de l'ID RustDesk."
|
||||
fi
|
||||
|
||||
# Afficher la valeur de la variable mot de passe
|
||||
echo "Mot de passe : $rustdesk_pw"
|
||||
echo "..............................................."
|
||||
|
||||
echo "Veuillez terminer l'installation sur GUI, lancement de RustDesk maintenant."
|
||||
open -n /Applications/RustDesk.app
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# Assigner une valeur aléatoire à la variable mot de passe
|
||||
rustdesk_pw=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)
|
||||
|
||||
# Obtenez votre chaîne de config depuis votre portail Web et remplissez ci-dessous
|
||||
rustdesk_cfg="configstring"
|
||||
|
||||
################################### Veuillez ne pas modifier en dessous de cette ligne #########################################
|
||||
|
||||
# Vérifier si le script est exécuté en tant que root
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Ce script doit être exécuté en tant que root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Identifier l'OS
|
||||
if [ -f /etc/os-release ]; then
|
||||
# freedesktop.org et systemd
|
||||
. /etc/os-release
|
||||
OS=$NAME
|
||||
VER=$VERSION_ID
|
||||
|
||||
UPSTREAM_ID=${ID_LIKE,,}
|
||||
|
||||
# Retomber sur ID_LIKE si ID n'était pas 'ubuntu' ou 'debian'
|
||||
if [ "${UPSTREAM_ID}" != "debian" ] && [ "${UPSTREAM_ID}" != "ubuntu" ]; then
|
||||
UPSTREAM_ID="$(echo ${ID_LIKE,,} | sed s/\"//g | cut -d' ' -f1)"
|
||||
fi
|
||||
|
||||
elif type lsb_release >/dev/null 2>&1; then
|
||||
# linuxbase.org
|
||||
OS=$(lsb_release -si)
|
||||
VER=$(lsb_release -sr)
|
||||
elif [ -f /etc/lsb-release ]; then
|
||||
# Pour certaines versions de Debian/Ubuntu sans la commande lsb_release
|
||||
. /etc/lsb-release
|
||||
OS=$DISTRIB_ID
|
||||
VER=$DISTRIB_RELEASE
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
# Debian plus ancien, Ubuntu, etc.
|
||||
OS=Debian
|
||||
VER=$(cat /etc/debian_version)
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
# SuSE plus ancien etc.
|
||||
OS=SuSE
|
||||
VER=$(cat /etc/SuSE-release)
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
# Red Hat plus ancien, CentOS, etc.
|
||||
OS=RedHat
|
||||
VER=$(cat /etc/redhat-release)
|
||||
else
|
||||
# Retomber sur uname, par exemple "Linux <version>", fonctionne aussi pour BSD, etc.
|
||||
OS=$(uname -s)
|
||||
VER=$(uname -r)
|
||||
fi
|
||||
|
||||
# Installer RustDesk
|
||||
|
||||
echo "Installation de RustDesk"
|
||||
if [ "${ID}" = "debian" ] || [ "$OS" = "Ubuntu" ] || [ "$OS" = "Debian" ] || [ "${UPSTREAM_ID}" = "ubuntu" ] || [ "${UPSTREAM_ID}" = "debian" ]; then
|
||||
wget https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.deb
|
||||
apt-get install -fy ./rustdesk-1.2.6-x86_64.deb > null
|
||||
elif [ "$OS" = "CentOS" ] || [ "$OS" = "RedHat" ] || [ "$OS" = "Fedora Linux" ] || [ "${UPSTREAM_ID}" = "rhel" ] || [ "$OS" = "Almalinux" ] || [ "$OS" = "Rocky*" ] ; then
|
||||
wget https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-0.x86_64.rpm
|
||||
yum localinstall ./rustdesk-1.2.6-0.x86_64.rpm -y > null
|
||||
else
|
||||
echo "OS non supporté"
|
||||
# ici vous pourriez demander à l'utilisateur la permission d'essayer d'installer quand même
|
||||
# s'il dit oui, alors faire l'installation
|
||||
# s'il dit non, quitter le script
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Exécuter la commande rustdesk avec --get-id et stocker la sortie dans la variable rustdesk_id
|
||||
rustdesk_id=$(rustdesk --get-id)
|
||||
|
||||
# Appliquer le nouveau mot de passe à RustDesk
|
||||
rustdesk --password $rustdesk_pw &> /dev/null
|
||||
|
||||
rustdesk --config $rustdesk_cfg
|
||||
|
||||
systemctl restart rustdesk
|
||||
|
||||
echo "..............................................."
|
||||
# Vérifier si rustdesk_id n'est pas vide
|
||||
if [ -n "$rustdesk_id" ]; then
|
||||
echo "ID RustDesk : $rustdesk_id"
|
||||
else
|
||||
echo "Échec de l'obtention de l'ID RustDesk."
|
||||
fi
|
||||
|
||||
# Afficher la valeur de la variable mot de passe
|
||||
echo "Mot de passe : $rustdesk_pw"
|
||||
echo "..............................................."
|
||||
```
|
||||
376
content/self-host/client-deployment/_index.it.md
Normal file
376
content/self-host/client-deployment/_index.it.md
Normal file
@@ -0,0 +1,376 @@
|
||||
---
|
||||
title: Distribuzione Client
|
||||
weight: 400
|
||||
pre: "<b>2.4. </b>"
|
||||
---
|
||||
|
||||
Il modo più semplice è utilizzare un client personalizzato, https://twitter.com/rustdesk/status/1788905463678951787.
|
||||
|
||||
Puoi distribuire utilizzando diversi metodi, alcuni sono coperti in [Configurazione Client](https://rustdesk.com/docs/en/self-host/client-configuration/).
|
||||
|
||||
In alternativa, puoi utilizzare script di distribuzione di massa con il tuo RMM, Intune, ecc. L'ID e la password sono outputtati dallo script. Dovresti raccogliere questo o dividerlo in script diversi per raccogliere l'ID e la password.
|
||||
|
||||
La password permanente può essere cambiata da casuale a una che preferisci modificando il contenuto dentro `()` dopo `rustdesk_pw` alla tua password preferita per PowerShell e la riga corrispondente per qualsiasi altra piattaforma.
|
||||
|
||||
### PowerShell
|
||||
|
||||
```powershell
|
||||
$ErrorActionPreference= 'silentlycontinue'
|
||||
|
||||
# Assegna il valore della password casuale alla variabile password
|
||||
$rustdesk_pw=(-join ((65..90) + (97..122) | Get-Random -Count 12 | % {[char]$_}))
|
||||
|
||||
# Ottieni la tua stringa di configurazione dal tuo portale Web e compila qui sotto
|
||||
$rustdesk_cfg="configstring"
|
||||
|
||||
################################### Per favore non modificare sotto questa linea #########################################
|
||||
|
||||
# Esegui come amministratore e rimani nella directory corrente
|
||||
if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
|
||||
{
|
||||
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000)
|
||||
{
|
||||
Start-Process PowerShell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";
|
||||
Exit;
|
||||
}
|
||||
}
|
||||
|
||||
# Questa funzione restituirà l'ultima versione e il link di download come oggetto
|
||||
function getLatest()
|
||||
{
|
||||
$Page = Invoke-WebRequest -Uri 'https://github.com/rustdesk/rustdesk/releases/latest' -UseBasicParsing
|
||||
$HTML = New-Object -Com "HTMLFile"
|
||||
try
|
||||
{
|
||||
$HTML.IHTMLDocument2_write($Page.Content)
|
||||
}
|
||||
catch
|
||||
{
|
||||
$src = [System.Text.Encoding]::Unicode.GetBytes($Page.Content)
|
||||
$HTML.write($src)
|
||||
}
|
||||
|
||||
# Link di esempio corrente: https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.exe
|
||||
$Downloadlink = ($HTML.Links | Where {$_.href -match '(.)+\/rustdesk\/rustdesk\/releases\/download\/\d{1}.\d{1,2}.\d{1,2}(.{0,3})\/rustdesk(.)+x86_64.exe'} | select -first 1).href
|
||||
|
||||
# correzione bug - a volte devi sostituire "about:"
|
||||
$Downloadlink = $Downloadlink.Replace('about:', 'https://github.com')
|
||||
|
||||
$Version = "unknown"
|
||||
if ($Downloadlink -match './rustdesk/rustdesk/releases/download/(?<content>.*)/rustdesk-(.)+x86_64.exe')
|
||||
{
|
||||
$Version = $matches['content']
|
||||
}
|
||||
|
||||
if ($Version -eq "unknown" -or $Downloadlink -eq "")
|
||||
{
|
||||
Write-Output "ERRORE: Versione o link di download non trovato."
|
||||
Exit
|
||||
}
|
||||
|
||||
# Crea oggetto da restituire
|
||||
$params += @{Version = $Version}
|
||||
$params += @{Downloadlink = $Downloadlink}
|
||||
$Result = New-Object PSObject -Property $params
|
||||
|
||||
return($Result)
|
||||
}
|
||||
|
||||
$RustDeskOnGitHub = getLatest
|
||||
|
||||
|
||||
$rdver = ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RustDesk\").Version)
|
||||
|
||||
if ($rdver -eq $RustDeskOnGitHub.Version)
|
||||
{
|
||||
Write-Output "RustDesk $rdver è la versione più recente."
|
||||
Exit
|
||||
}
|
||||
|
||||
if (!(Test-Path C:\Temp))
|
||||
{
|
||||
New-Item -ItemType Directory -Force -Path C:\Temp | Out-Null
|
||||
}
|
||||
|
||||
cd C:\Temp
|
||||
|
||||
Invoke-WebRequest $RustDeskOnGitHub.Downloadlink -Outfile "rustdesk.exe"
|
||||
Start-Process .\rustdesk.exe --silent-install
|
||||
Start-Sleep -seconds 20
|
||||
|
||||
$ServiceName = 'Rustdesk'
|
||||
$arrService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
|
||||
|
||||
if ($arrService -eq $null)
|
||||
{
|
||||
Write-Output "Installazione servizio"
|
||||
cd $env:ProgramFiles\RustDesk
|
||||
Start-Process .\rustdesk.exe --install-service
|
||||
Start-Sleep -seconds 20
|
||||
$arrService = Get-Service -Name $ServiceName
|
||||
}
|
||||
|
||||
while ($arrService.Status -ne 'Running')
|
||||
{
|
||||
Start-Service $ServiceName
|
||||
Start-Sleep -seconds 5
|
||||
$arrService.Refresh()
|
||||
}
|
||||
|
||||
cd $env:ProgramFiles\RustDesk\
|
||||
.\rustdesk.exe --get-id | Write-Output -OutVariable rustdesk_id
|
||||
|
||||
.\rustdesk.exe --config $rustdesk_cfg
|
||||
|
||||
.\rustdesk.exe --password $rustdesk_pw
|
||||
|
||||
Write-Output "..............................................."
|
||||
# Mostra il valore della variabile ID
|
||||
Write-Output "ID RustDesk: $rustdesk_id"
|
||||
|
||||
# Mostra il valore della variabile password
|
||||
Write-Output "Password: $rustdesk_pw"
|
||||
Write-Output "..............................................."
|
||||
```
|
||||
|
||||
### Windows batch/cmd
|
||||
|
||||
```bat
|
||||
@echo off
|
||||
|
||||
REM Assegna il valore della password casuale alla variabile password
|
||||
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
|
||||
set alfanum=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
|
||||
set rustdesk_pw=
|
||||
for /L %%b in (1, 1, 12) do (
|
||||
set /A rnd_num=!RANDOM! %% 62
|
||||
for %%c in (!rnd_num!) do (
|
||||
set rustdesk_pw=!rustdesk_pw!!alfanum:~%%c,1!
|
||||
)
|
||||
)
|
||||
|
||||
REM Ottieni la tua stringa di configurazione dal tuo portale Web e compila qui sotto
|
||||
set rustdesk_cfg="configstring"
|
||||
|
||||
REM ############################### Per favore non modificare sotto questa linea #########################################
|
||||
|
||||
if not exist C:\Temp\ md C:\Temp\
|
||||
cd C:\Temp\
|
||||
|
||||
curl -L "https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.exe" -o rustdesk.exe
|
||||
|
||||
rustdesk.exe --silent-install
|
||||
timeout /t 20
|
||||
|
||||
cd "C:\Program Files\RustDesk\"
|
||||
rustdesk.exe --install-service
|
||||
timeout /t 20
|
||||
|
||||
for /f "delims=" %%i in ('rustdesk.exe --get-id ^| more') do set rustdesk_id=%%i
|
||||
|
||||
rustdesk.exe --config %rustdesk_cfg%
|
||||
|
||||
rustdesk.exe --password %rustdesk_pw%
|
||||
|
||||
echo ...............................................
|
||||
REM Mostra il valore della variabile ID
|
||||
echo ID RustDesk: %rustdesk_id%
|
||||
|
||||
REM Mostra il valore della variabile password
|
||||
echo Password: %rustdesk_pw%
|
||||
echo ...............................................
|
||||
```
|
||||
|
||||
### MSI
|
||||
|
||||
Puoi anche usare msi invece di `rustdesk.exe --silent-install`.
|
||||
|
||||
https://rustdesk.com/docs/en/client/windows/msi/
|
||||
|
||||
|
||||
### Winget
|
||||
|
||||
puoi distribuire tramite powershell con winget anche (questo installa tramite la versione Microsoft di apt - parte delle installazioni Windows più recenti)
|
||||
|
||||
da una finestra powershell o tramite script (ad esempio tramite GPO)
|
||||
|
||||
```
|
||||
winget install --id=RustDesk.RustDesk -e
|
||||
```
|
||||
|
||||
### macOS Bash
|
||||
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# Assegna il valore della password casuale alla variabile password
|
||||
rustdesk_pw=$(openssl rand -hex 4)
|
||||
|
||||
# Ottieni la tua stringa di configurazione dal tuo portale Web e compila qui sotto
|
||||
rustdesk_cfg="configstring"
|
||||
|
||||
################################### Per favore non modificare sotto questa linea #########################################
|
||||
|
||||
# Richiesta password root per l'elevazione dei privilegi
|
||||
[ "$UID" -eq 0 ] || exec sudo bash "$0" "$@"
|
||||
|
||||
# Specifica il punto di montaggio per il DMG (directory temporanea)
|
||||
mount_point="/Volumes/RustDesk"
|
||||
|
||||
# Scarica il file rustdesk.dmg
|
||||
echo "Scaricando RustDesk ora"
|
||||
|
||||
if [[ $(arch) == 'arm64' ]]; then
|
||||
rd_link=$(curl -sL https://github.com/rustdesk/rustdesk/releases/latest | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*/\d{1}.\d{1,2}.\d{1,2}/rustdesk.\d{1}.\d{1,2}.\d{1,2}.aarch64.dmg")
|
||||
dmg_file=$(echo $rd_link | grep -Eo "rustdesk.\d{1}.\d{1,2}.\d{1,2}.aarch64.dmg")
|
||||
curl -L "$rd_link" --output "$dmg_file"
|
||||
else
|
||||
rd_link=$(curl -sL https://github.com/rustdesk/rustdesk/releases/latest | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*/\d{1}.\d{1,2}.\d{1,2}/rustdesk.\d{1}.\d{1,2}.\d{1,2}.x86_64.dmg")
|
||||
dmg_file=$(echo $rd_link | grep -Eo "rustdesk.\d{1}.\d{1,2}.\d{1,2}.x86_64.dmg")
|
||||
curl -L "$rd_link" --output "$dmg_file"
|
||||
fi
|
||||
|
||||
# Monta il file DMG al punto di montaggio specificato
|
||||
hdiutil attach "$dmg_file" -mountpoint "$mount_point" &> /dev/null
|
||||
|
||||
# Controlla se il montaggio è riuscito
|
||||
if [ $? -eq 0 ]; then
|
||||
# Sposta il contenuto del DMG montato nella cartella /Applications
|
||||
cp -R "$mount_point/RustDesk.app" "/Applications/" &> /dev/null
|
||||
|
||||
# Smonta il file DMG
|
||||
hdiutil detach "$mount_point" &> /dev/null
|
||||
else
|
||||
echo "Impossibile montare il DMG RustDesk. Installazione interrotta."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Esegui il comando rustdesk con --get-id e memorizza l'output nella variabile rustdesk_id
|
||||
cd /Applications/RustDesk.app/Contents/MacOS/
|
||||
rustdesk_id=$(./RustDesk --get-id)
|
||||
|
||||
# Applica nuova password a RustDesk
|
||||
./RustDesk --server &
|
||||
/Applications/RustDesk.app/Contents/MacOS/RustDesk --password $rustdesk_pw &> /dev/null
|
||||
|
||||
/Applications/RustDesk.app/Contents/MacOS/RustDesk --config $rustdesk_cfg
|
||||
|
||||
# Termina tutti i processi chiamati RustDesk
|
||||
rdpid=$(pgrep RustDesk)
|
||||
kill $rdpid &> /dev/null
|
||||
|
||||
echo "..............................................."
|
||||
# Controlla se rustdesk_id non è vuoto
|
||||
if [ -n "$rustdesk_id" ]; then
|
||||
echo "ID RustDesk: $rustdesk_id"
|
||||
else
|
||||
echo "Impossibile ottenere l'ID RustDesk."
|
||||
fi
|
||||
|
||||
# Mostra il valore della variabile password
|
||||
echo "Password: $rustdesk_pw"
|
||||
echo "..............................................."
|
||||
|
||||
echo "Per favore completa l'installazione su GUI, avviando RustDesk ora."
|
||||
open -n /Applications/RustDesk.app
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# Assegna un valore casuale alla variabile password
|
||||
rustdesk_pw=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)
|
||||
|
||||
# Ottieni la tua stringa di configurazione dal tuo portale Web e compila qui sotto
|
||||
rustdesk_cfg="configstring"
|
||||
|
||||
################################### Per favore non modificare sotto questa linea #########################################
|
||||
|
||||
# Controlla se lo script è in esecuzione come root
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Questo script deve essere eseguito come root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Identifica OS
|
||||
if [ -f /etc/os-release ]; then
|
||||
# freedesktop.org e systemd
|
||||
. /etc/os-release
|
||||
OS=$NAME
|
||||
VER=$VERSION_ID
|
||||
|
||||
UPSTREAM_ID=${ID_LIKE,,}
|
||||
|
||||
# Fallback a ID_LIKE se ID non era 'ubuntu' o 'debian'
|
||||
if [ "${UPSTREAM_ID}" != "debian" ] && [ "${UPSTREAM_ID}" != "ubuntu" ]; then
|
||||
UPSTREAM_ID="$(echo ${ID_LIKE,,} | sed s/\"//g | cut -d' ' -f1)"
|
||||
fi
|
||||
|
||||
elif type lsb_release >/dev/null 2>&1; then
|
||||
# linuxbase.org
|
||||
OS=$(lsb_release -si)
|
||||
VER=$(lsb_release -sr)
|
||||
elif [ -f /etc/lsb-release ]; then
|
||||
# Per alcune versioni di Debian/Ubuntu senza il comando lsb_release
|
||||
. /etc/lsb-release
|
||||
OS=$DISTRIB_ID
|
||||
VER=$DISTRIB_RELEASE
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
# Debian più vecchio, Ubuntu, ecc.
|
||||
OS=Debian
|
||||
VER=$(cat /etc/debian_version)
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
# SuSE più vecchio ecc.
|
||||
OS=SuSE
|
||||
VER=$(cat /etc/SuSE-release)
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
# Red Hat più vecchio, CentOS, ecc.
|
||||
OS=RedHat
|
||||
VER=$(cat /etc/redhat-release)
|
||||
else
|
||||
# Fallback a uname, ad es. "Linux <version>", funziona anche per BSD, ecc.
|
||||
OS=$(uname -s)
|
||||
VER=$(uname -r)
|
||||
fi
|
||||
|
||||
# Installa RustDesk
|
||||
|
||||
echo "Installazione di RustDesk"
|
||||
if [ "${ID}" = "debian" ] || [ "$OS" = "Ubuntu" ] || [ "$OS" = "Debian" ] || [ "${UPSTREAM_ID}" = "ubuntu" ] || [ "${UPSTREAM_ID}" = "debian" ]; then
|
||||
wget https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.deb
|
||||
apt-get install -fy ./rustdesk-1.2.6-x86_64.deb > null
|
||||
elif [ "$OS" = "CentOS" ] || [ "$OS" = "RedHat" ] || [ "$OS" = "Fedora Linux" ] || [ "${UPSTREAM_ID}" = "rhel" ] || [ "$OS" = "Almalinux" ] || [ "$OS" = "Rocky*" ] ; then
|
||||
wget https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-0.x86_64.rpm
|
||||
yum localinstall ./rustdesk-1.2.6-0.x86_64.rpm -y > null
|
||||
else
|
||||
echo "OS non supportato"
|
||||
# qui potresti chiedere all'utente il permesso di provare a installare comunque
|
||||
# se dicono sì, allora fai l'installazione
|
||||
# se dicono no, esci dallo script
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Esegui il comando rustdesk con --get-id e memorizza l'output nella variabile rustdesk_id
|
||||
rustdesk_id=$(rustdesk --get-id)
|
||||
|
||||
# Applica nuova password a RustDesk
|
||||
rustdesk --password $rustdesk_pw &> /dev/null
|
||||
|
||||
rustdesk --config $rustdesk_cfg
|
||||
|
||||
systemctl restart rustdesk
|
||||
|
||||
echo "..............................................."
|
||||
# Controlla se rustdesk_id non è vuoto
|
||||
if [ -n "$rustdesk_id" ]; then
|
||||
echo "ID RustDesk: $rustdesk_id"
|
||||
else
|
||||
echo "Impossibile ottenere l'ID RustDesk."
|
||||
fi
|
||||
|
||||
# Mostra il valore della variabile password
|
||||
echo "Password: $rustdesk_pw"
|
||||
echo "..............................................."
|
||||
```
|
||||
376
content/self-host/client-deployment/_index.ja.md
Normal file
376
content/self-host/client-deployment/_index.ja.md
Normal file
@@ -0,0 +1,376 @@
|
||||
---
|
||||
title: クライアントデプロイメント
|
||||
weight: 400
|
||||
pre: "<b>2.4. </b>"
|
||||
---
|
||||
|
||||
最も簡単な方法はカスタムクライアントを使用することです、https://twitter.com/rustdesk/status/1788905463678951787。
|
||||
|
||||
いくつかの方法でデプロイできます。一部は[クライアント設定](https://rustdesk.com/docs/en/self-host/client-configuration/)でカバーされています。
|
||||
|
||||
あるいは、RMM、Intuneなどで一括デプロイメントスクリプトを使用できます。IDとパスワードはスクリプトによって出力されます。これを収集するか、IDとパスワードを収集するために別々のスクリプトに分割する必要があります。
|
||||
|
||||
永続パスワードは、PowerShellの`rustdesk_pw`の後の`()`内の内容をお好みのパスワードに変更し、他のプラットフォームの対応する行を変更することで、ランダムからお好みのものに変更できます。
|
||||
|
||||
### PowerShell
|
||||
|
||||
```powershell
|
||||
$ErrorActionPreference= 'silentlycontinue'
|
||||
|
||||
# パスワード変数にランダムパスワード値を割り当てる
|
||||
$rustdesk_pw=(-join ((65..90) + (97..122) | Get-Random -Count 12 | % {[char]$_}))
|
||||
|
||||
# Webポータルから設定文字列を取得し、以下で入力してください
|
||||
$rustdesk_cfg="configstring"
|
||||
|
||||
################################### この線より下を編集しないでください #########################################
|
||||
|
||||
# 管理者として実行し、現在のディレクトリに残る
|
||||
if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
|
||||
{
|
||||
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000)
|
||||
{
|
||||
Start-Process PowerShell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";
|
||||
Exit;
|
||||
}
|
||||
}
|
||||
|
||||
# この関数は最新バージョンとダウンロードリンクをオブジェクトとして返します
|
||||
function getLatest()
|
||||
{
|
||||
$Page = Invoke-WebRequest -Uri 'https://github.com/rustdesk/rustdesk/releases/latest' -UseBasicParsing
|
||||
$HTML = New-Object -Com "HTMLFile"
|
||||
try
|
||||
{
|
||||
$HTML.IHTMLDocument2_write($Page.Content)
|
||||
}
|
||||
catch
|
||||
{
|
||||
$src = [System.Text.Encoding]::Unicode.GetBytes($Page.Content)
|
||||
$HTML.write($src)
|
||||
}
|
||||
|
||||
# 現在の例リンク: https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.exe
|
||||
$Downloadlink = ($HTML.Links | Where {$_.href -match '(.)+\/rustdesk\/rustdesk\/releases\/download\/\d{1}.\d{1,2}.\d{1,2}(.{0,3})\/rustdesk(.)+x86_64.exe'} | select -first 1).href
|
||||
|
||||
# バグ修正 - 時々"about:"を置き換える必要があります
|
||||
$Downloadlink = $Downloadlink.Replace('about:', 'https://github.com')
|
||||
|
||||
$Version = "unknown"
|
||||
if ($Downloadlink -match './rustdesk/rustdesk/releases/download/(?<content>.*)/rustdesk-(.)+x86_64.exe')
|
||||
{
|
||||
$Version = $matches['content']
|
||||
}
|
||||
|
||||
if ($Version -eq "unknown" -or $Downloadlink -eq "")
|
||||
{
|
||||
Write-Output "エラー: バージョンまたはダウンロードリンクが見つかりません。"
|
||||
Exit
|
||||
}
|
||||
|
||||
# 返すオブジェクトを作成
|
||||
$params += @{Version = $Version}
|
||||
$params += @{Downloadlink = $Downloadlink}
|
||||
$Result = New-Object PSObject -Property $params
|
||||
|
||||
return($Result)
|
||||
}
|
||||
|
||||
$RustDeskOnGitHub = getLatest
|
||||
|
||||
|
||||
$rdver = ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RustDesk\").Version)
|
||||
|
||||
if ($rdver -eq $RustDeskOnGitHub.Version)
|
||||
{
|
||||
Write-Output "RustDesk $rdver は最新バージョンです。"
|
||||
Exit
|
||||
}
|
||||
|
||||
if (!(Test-Path C:\Temp))
|
||||
{
|
||||
New-Item -ItemType Directory -Force -Path C:\Temp | Out-Null
|
||||
}
|
||||
|
||||
cd C:\Temp
|
||||
|
||||
Invoke-WebRequest $RustDeskOnGitHub.Downloadlink -Outfile "rustdesk.exe"
|
||||
Start-Process .\rustdesk.exe --silent-install
|
||||
Start-Sleep -seconds 20
|
||||
|
||||
$ServiceName = 'Rustdesk'
|
||||
$arrService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
|
||||
|
||||
if ($arrService -eq $null)
|
||||
{
|
||||
Write-Output "サービスをインストール中"
|
||||
cd $env:ProgramFiles\RustDesk
|
||||
Start-Process .\rustdesk.exe --install-service
|
||||
Start-Sleep -seconds 20
|
||||
$arrService = Get-Service -Name $ServiceName
|
||||
}
|
||||
|
||||
while ($arrService.Status -ne 'Running')
|
||||
{
|
||||
Start-Service $ServiceName
|
||||
Start-Sleep -seconds 5
|
||||
$arrService.Refresh()
|
||||
}
|
||||
|
||||
cd $env:ProgramFiles\RustDesk\
|
||||
.\rustdesk.exe --get-id | Write-Output -OutVariable rustdesk_id
|
||||
|
||||
.\rustdesk.exe --config $rustdesk_cfg
|
||||
|
||||
.\rustdesk.exe --password $rustdesk_pw
|
||||
|
||||
Write-Output "..............................................."
|
||||
# ID変数の値を表示
|
||||
Write-Output "RustDesk ID: $rustdesk_id"
|
||||
|
||||
# パスワード変数の値を表示
|
||||
Write-Output "パスワード: $rustdesk_pw"
|
||||
Write-Output "..............................................."
|
||||
```
|
||||
|
||||
### Windows batch/cmd
|
||||
|
||||
```bat
|
||||
@echo off
|
||||
|
||||
REM パスワード変数にランダムパスワード値を割り当てる
|
||||
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
|
||||
set alfanum=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
|
||||
set rustdesk_pw=
|
||||
for /L %%b in (1, 1, 12) do (
|
||||
set /A rnd_num=!RANDOM! %% 62
|
||||
for %%c in (!rnd_num!) do (
|
||||
set rustdesk_pw=!rustdesk_pw!!alfanum:~%%c,1!
|
||||
)
|
||||
)
|
||||
|
||||
REM Webポータルから設定文字列を取得し、以下で入力してください
|
||||
set rustdesk_cfg="configstring"
|
||||
|
||||
REM ############################### この線より下を編集しないでください #########################################
|
||||
|
||||
if not exist C:\Temp\ md C:\Temp\
|
||||
cd C:\Temp\
|
||||
|
||||
curl -L "https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.exe" -o rustdesk.exe
|
||||
|
||||
rustdesk.exe --silent-install
|
||||
timeout /t 20
|
||||
|
||||
cd "C:\Program Files\RustDesk\"
|
||||
rustdesk.exe --install-service
|
||||
timeout /t 20
|
||||
|
||||
for /f "delims=" %%i in ('rustdesk.exe --get-id ^| more') do set rustdesk_id=%%i
|
||||
|
||||
rustdesk.exe --config %rustdesk_cfg%
|
||||
|
||||
rustdesk.exe --password %rustdesk_pw%
|
||||
|
||||
echo ...............................................
|
||||
REM ID変数の値を表示
|
||||
echo RustDesk ID: %rustdesk_id%
|
||||
|
||||
REM パスワード変数の値を表示
|
||||
echo パスワード: %rustdesk_pw%
|
||||
echo ...............................................
|
||||
```
|
||||
|
||||
### MSI
|
||||
|
||||
`rustdesk.exe --silent-install`の代わりにmsiを使用することもできます。
|
||||
|
||||
https://rustdesk.com/docs/en/client/windows/msi/
|
||||
|
||||
|
||||
### Winget
|
||||
|
||||
wingetを使ってpowershell経由でデプロイすることもできます(これは最近のWindowsインストールの一部であるMicrosoft版apt経由でインストールします)
|
||||
|
||||
powershellウィンドウから、またはスクリプト経由で(例えばGPO経由)
|
||||
|
||||
```
|
||||
winget install --id=RustDesk.RustDesk -e
|
||||
```
|
||||
|
||||
### macOS Bash
|
||||
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# パスワード変数にランダムパスワード値を割り当てる
|
||||
rustdesk_pw=$(openssl rand -hex 4)
|
||||
|
||||
# Webポータルから設定文字列を取得し、以下で入力してください
|
||||
rustdesk_cfg="configstring"
|
||||
|
||||
################################### この線より下を編集しないでください #########################################
|
||||
|
||||
# 特権昇格のためのrootパスワードの要求
|
||||
[ "$UID" -eq 0 ] || exec sudo bash "$0" "$@"
|
||||
|
||||
# DMGのマウントポイントを指定(一時ディレクトリ)
|
||||
mount_point="/Volumes/RustDesk"
|
||||
|
||||
# rustdesk.dmgファイルをダウンロード
|
||||
echo "RustDeskをダウンロード中"
|
||||
|
||||
if [[ $(arch) == 'arm64' ]]; then
|
||||
rd_link=$(curl -sL https://github.com/rustdesk/rustdesk/releases/latest | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*/\d{1}.\d{1,2}.\d{1,2}/rustdesk.\d{1}.\d{1,2}.\d{1,2}.aarch64.dmg")
|
||||
dmg_file=$(echo $rd_link | grep -Eo "rustdesk.\d{1}.\d{1,2}.\d{1,2}.aarch64.dmg")
|
||||
curl -L "$rd_link" --output "$dmg_file"
|
||||
else
|
||||
rd_link=$(curl -sL https://github.com/rustdesk/rustdesk/releases/latest | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*/\d{1}.\d{1,2}.\d{1,2}/rustdesk.\d{1}.\d{1,2}.\d{1,2}.x86_64.dmg")
|
||||
dmg_file=$(echo $rd_link | grep -Eo "rustdesk.\d{1}.\d{1,2}.\d{1,2}.x86_64.dmg")
|
||||
curl -L "$rd_link" --output "$dmg_file"
|
||||
fi
|
||||
|
||||
# DMGファイルを指定したマウントポイントにマウント
|
||||
hdiutil attach "$dmg_file" -mountpoint "$mount_point" &> /dev/null
|
||||
|
||||
# マウントが成功したか確認
|
||||
if [ $? -eq 0 ]; then
|
||||
# マウントされたDMGの内容を/Applicationsフォルダに移動
|
||||
cp -R "$mount_point/RustDesk.app" "/Applications/" &> /dev/null
|
||||
|
||||
# DMGファイルをアンマウント
|
||||
hdiutil detach "$mount_point" &> /dev/null
|
||||
else
|
||||
echo "RustDesk DMGのマウントに失敗しました。インストールを中止します。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --get-idでrustdeskコマンドを実行し、出力をrustdesk_id変数で保存
|
||||
cd /Applications/RustDesk.app/Contents/MacOS/
|
||||
rustdesk_id=$(./RustDesk --get-id)
|
||||
|
||||
# RustDeskに新しいパスワードを適用
|
||||
./RustDesk --server &
|
||||
/Applications/RustDesk.app/Contents/MacOS/RustDesk --password $rustdesk_pw &> /dev/null
|
||||
|
||||
/Applications/RustDesk.app/Contents/MacOS/RustDesk --config $rustdesk_cfg
|
||||
|
||||
# RustDeskという名前のすべてのプロセスを終了
|
||||
rdpid=$(pgrep RustDesk)
|
||||
kill $rdpid &> /dev/null
|
||||
|
||||
echo "..............................................."
|
||||
# rustdesk_idが空でないか確認
|
||||
if [ -n "$rustdesk_id" ]; then
|
||||
echo "RustDesk ID: $rustdesk_id"
|
||||
else
|
||||
echo "RustDesk IDの取得に失敗しました。"
|
||||
fi
|
||||
|
||||
# パスワード変数の値を表示
|
||||
echo "パスワード: $rustdesk_pw"
|
||||
echo "..............................................."
|
||||
|
||||
echo "GUIでインストールを完了してください。RustDeskを起動します。"
|
||||
open -n /Applications/RustDesk.app
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# パスワード変数にランダム値を割り当てる
|
||||
rustdesk_pw=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)
|
||||
|
||||
# Webポータルから設定文字列を取得し、以下で入力してください
|
||||
rustdesk_cfg="configstring"
|
||||
|
||||
################################### この線より下を編集しないでください #########################################
|
||||
|
||||
# スクリプトがrootとして実行されているか確認
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "このスクリプトはrootとして実行する必要があります。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# OSを特定
|
||||
if [ -f /etc/os-release ]; then
|
||||
# freedesktop.orgとsystemd
|
||||
. /etc/os-release
|
||||
OS=$NAME
|
||||
VER=$VERSION_ID
|
||||
|
||||
UPSTREAM_ID=${ID_LIKE,,}
|
||||
|
||||
# IDが'ubuntu'または'debian'でない場合はID_LIKEにフォールバック
|
||||
if [ "${UPSTREAM_ID}" != "debian" ] && [ "${UPSTREAM_ID}" != "ubuntu" ]; then
|
||||
UPSTREAM_ID="$(echo ${ID_LIKE,,} | sed s/\"//g | cut -d' ' -f1)"
|
||||
fi
|
||||
|
||||
elif type lsb_release >/dev/null 2>&1; then
|
||||
# linuxbase.org
|
||||
OS=$(lsb_release -si)
|
||||
VER=$(lsb_release -sr)
|
||||
elif [ -f /etc/lsb-release ]; then
|
||||
# lsb_releaseコマンドがない一部のDebian/Ubuntuバージョン用
|
||||
. /etc/lsb-release
|
||||
OS=$DISTRIB_ID
|
||||
VER=$DISTRIB_RELEASE
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
# 古いDebian、Ubuntuなど
|
||||
OS=Debian
|
||||
VER=$(cat /etc/debian_version)
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
# 古いSuSEなど
|
||||
OS=SuSE
|
||||
VER=$(cat /etc/SuSE-release)
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
# 古いRed Hat、CentOSなど
|
||||
OS=RedHat
|
||||
VER=$(cat /etc/redhat-release)
|
||||
else
|
||||
# unameにフォールバック、例えば"Linux <version>"、BSDなどでも動作
|
||||
OS=$(uname -s)
|
||||
VER=$(uname -r)
|
||||
fi
|
||||
|
||||
# RustDeskをインストール
|
||||
|
||||
echo "RustDeskをインストール中"
|
||||
if [ "${ID}" = "debian" ] || [ "$OS" = "Ubuntu" ] || [ "$OS" = "Debian" ] || [ "${UPSTREAM_ID}" = "ubuntu" ] || [ "${UPSTREAM_ID}" = "debian" ]; then
|
||||
wget https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.deb
|
||||
apt-get install -fy ./rustdesk-1.2.6-x86_64.deb > null
|
||||
elif [ "$OS" = "CentOS" ] || [ "$OS" = "RedHat" ] || [ "$OS" = "Fedora Linux" ] || [ "${UPSTREAM_ID}" = "rhel" ] || [ "$OS" = "Almalinux" ] || [ "$OS" = "Rocky*" ] ; then
|
||||
wget https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-0.x86_64.rpm
|
||||
yum localinstall ./rustdesk-1.2.6-0.x86_64.rpm -y > null
|
||||
else
|
||||
echo "サポートされていないOS"
|
||||
# ここでユーザーにとにかくインストールを試す許可を求めることができます
|
||||
# 彼らがはいと言った場合、インストールを実行
|
||||
# 彼らがいいえと言った場合、スクリプトを終了
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --get-idでrustdeskコマンドを実行し、出力をrustdesk_id変数で保存
|
||||
rustdesk_id=$(rustdesk --get-id)
|
||||
|
||||
# RustDeskに新しいパスワードを適用
|
||||
rustdesk --password $rustdesk_pw &> /dev/null
|
||||
|
||||
rustdesk --config $rustdesk_cfg
|
||||
|
||||
systemctl restart rustdesk
|
||||
|
||||
echo "..............................................."
|
||||
# rustdesk_idが空でないか確認
|
||||
if [ -n "$rustdesk_id" ]; then
|
||||
echo "RustDesk ID: $rustdesk_id"
|
||||
else
|
||||
echo "RustDesk IDの取得に失敗しました。"
|
||||
fi
|
||||
|
||||
# パスワード変数の値を表示
|
||||
echo "パスワード: $rustdesk_pw"
|
||||
echo "..............................................."
|
||||
```
|
||||
@@ -1,31 +1,31 @@
|
||||
---
|
||||
title: Implantação de cliente
|
||||
title: Implantação do Cliente
|
||||
weight: 400
|
||||
pre: "<b>2.4. </b>"
|
||||
---
|
||||
|
||||
A maneira mais simples é usar um cliente personalizado, https://twitter.com/rustdesk/status/1788905463678951787.
|
||||
|
||||
Você pode implementar o cliente personalizado usando vários métodos, alguns dos quais são abordados em [Configuração do Cliente](https://rustdesk.com/docs/pt/self-host/client-configuration/).
|
||||
Você pode implantar usando vários métodos, alguns são cobertos em [Configuração do Cliente](https://rustdesk.com/docs/en/self-host/client-configuration/).
|
||||
|
||||
Como alternativa, você pode usar scripts de implementação em massa com seu RMM, Intune etc. O script irá gerar a ID e a senha. Você deve coletar essas informações ou dividi-las em scripts diferentes para coletar a ID e a senha separadamente.
|
||||
Alternativamente, você pode usar scripts de implantação em massa com seu RMM, Intune, etc. O ID e a senha são outputados pelo script. Você deve coletar isso ou dividi-lo em scripts diferentes para coletar o ID e a senha.
|
||||
|
||||
A senha permanente aleatória pode ser alterada para uma senha de sua preferência. Para fazer isso, altere o conteúdo dentro dos `()` após `rustdesk_pw` para a senha desejada no PowerShell e na linha correspondente para qualquer outra plataforma.
|
||||
A senha permanente pode ser alterada de aleatória para uma de sua preferência modificando o conteúdo dentro de `()` após `rustdesk_pw` para sua senha preferida para PowerShell e a linha correspondente para qualquer outra plataforma.
|
||||
|
||||
### PowerShell
|
||||
|
||||
```ps
|
||||
```powershell
|
||||
$ErrorActionPreference= 'silentlycontinue'
|
||||
|
||||
# Atribua o valor de senha aleatória à variável password
|
||||
# Atribuir o valor da senha aleatória à variável senha
|
||||
$rustdesk_pw=(-join ((65..90) + (97..122) | Get-Random -Count 12 | % {[char]$_}))
|
||||
|
||||
# Obtenha sua string de configuração do seu portal da Web e preencha abaixo
|
||||
# Obtenha sua string de configuração do seu portal Web e preencha abaixo
|
||||
$rustdesk_cfg="configstring"
|
||||
|
||||
################################### Please Do Not Edit Below This Line #########################################
|
||||
################################### Por favor não edite abaixo desta linha #########################################
|
||||
|
||||
# Execute como administrador e permaneça no diretório atual
|
||||
# Executar como administrador e permanecer no diretório atual
|
||||
if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
|
||||
{
|
||||
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000)
|
||||
@@ -35,7 +35,7 @@ if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdenti
|
||||
}
|
||||
}
|
||||
|
||||
# Esta função retornará a versão mais recente e o link de download como um objeto
|
||||
# Esta função retornará a última versão e link de download como um objeto
|
||||
function getLatest()
|
||||
{
|
||||
$Page = Invoke-WebRequest -Uri 'https://github.com/rustdesk/rustdesk/releases/latest' -UseBasicParsing
|
||||
@@ -50,10 +50,10 @@ function getLatest()
|
||||
$HTML.write($src)
|
||||
}
|
||||
|
||||
# Link de exemplo atual: https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.exe
|
||||
# Link de exemplo atual: https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.exe
|
||||
$Downloadlink = ($HTML.Links | Where {$_.href -match '(.)+\/rustdesk\/rustdesk\/releases\/download\/\d{1}.\d{1,2}.\d{1,2}(.{0,3})\/rustdesk(.)+x86_64.exe'} | select -first 1).href
|
||||
|
||||
# correção de bug - às vezes é necessário substituir "about:"
|
||||
# correção de bug - às vezes você precisa substituir "about:"
|
||||
$Downloadlink = $Downloadlink.Replace('about:', 'https://github.com')
|
||||
|
||||
$Version = "unknown"
|
||||
@@ -64,11 +64,11 @@ function getLatest()
|
||||
|
||||
if ($Version -eq "unknown" -or $Downloadlink -eq "")
|
||||
{
|
||||
Write-Output "ERROR: Version or download link not found."
|
||||
Write-Output "ERRO: Versão ou link de download não encontrado."
|
||||
Exit
|
||||
}
|
||||
|
||||
# Crie um objeto para retornar
|
||||
# Criar objeto para retornar
|
||||
$params += @{Version = $Version}
|
||||
$params += @{Downloadlink = $Downloadlink}
|
||||
$Result = New-Object PSObject -Property $params
|
||||
@@ -83,13 +83,13 @@ $rdver = ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Un
|
||||
|
||||
if ($rdver -eq $RustDeskOnGitHub.Version)
|
||||
{
|
||||
Write-Output "RustDesk $rdver is the newest version."
|
||||
Write-Output "RustDesk $rdver é a versão mais recente."
|
||||
Exit
|
||||
}
|
||||
|
||||
if (!(Test-Path C:\Temp))
|
||||
{
|
||||
New-Item -ItemType Directory -Force -Path C:\Temp > null
|
||||
New-Item -ItemType Directory -Force -Path C:\Temp | Out-Null
|
||||
}
|
||||
|
||||
cd C:\Temp
|
||||
@@ -103,7 +103,7 @@ $arrService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
|
||||
|
||||
if ($arrService -eq $null)
|
||||
{
|
||||
Write-Output "Installing service"
|
||||
Write-Output "Instalando serviço"
|
||||
cd $env:ProgramFiles\RustDesk
|
||||
Start-Process .\rustdesk.exe --install-service
|
||||
Start-Sleep -seconds 20
|
||||
@@ -125,11 +125,11 @@ cd $env:ProgramFiles\RustDesk\
|
||||
.\rustdesk.exe --password $rustdesk_pw
|
||||
|
||||
Write-Output "..............................................."
|
||||
# Mostre o valor da variável ID
|
||||
Write-Output "RustDesk ID: $rustdesk_id"
|
||||
# Mostrar o valor da variável ID
|
||||
Write-Output "ID RustDesk: $rustdesk_id"
|
||||
|
||||
# Mostre o valor da variável Password
|
||||
Write-Output "Password: $rustdesk_pw"
|
||||
# Mostrar o valor da variável senha
|
||||
Write-Output "Senha: $rustdesk_pw"
|
||||
Write-Output "..............................................."
|
||||
```
|
||||
|
||||
@@ -138,7 +138,7 @@ Write-Output "..............................................."
|
||||
```bat
|
||||
@echo off
|
||||
|
||||
REM Define o valor da senha aleatória para a variável password
|
||||
REM Atribuir o valor da senha aleatória à variável senha
|
||||
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
|
||||
set alfanum=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
|
||||
set rustdesk_pw=
|
||||
@@ -149,10 +149,10 @@ for /L %%b in (1, 1, 12) do (
|
||||
)
|
||||
)
|
||||
|
||||
REM Preencha a string de configuração (configstring) obtida do portal web
|
||||
REM Obtenha sua string de configuração do seu portal Web e preencha abaixo
|
||||
set rustdesk_cfg="configstring"
|
||||
|
||||
REM ############################### Por favor, não edite abaixo desta linha #########################################
|
||||
REM ############################### Por favor não edite abaixo desta linha #########################################
|
||||
|
||||
if not exist C:\Temp\ md C:\Temp\
|
||||
cd C:\Temp\
|
||||
@@ -174,10 +174,10 @@ rustdesk.exe --password %rustdesk_pw%
|
||||
|
||||
echo ...............................................
|
||||
REM Mostrar o valor da variável ID
|
||||
echo RustDesk ID: %rustdesk_id%
|
||||
echo ID RustDesk: %rustdesk_id%
|
||||
|
||||
REM Mostra o valor da variável de senha
|
||||
echo Password: %rustdesk_pw%
|
||||
REM Mostrar o valor da variável senha
|
||||
echo Senha: %rustdesk_pw%
|
||||
echo ...............................................
|
||||
```
|
||||
|
||||
@@ -187,82 +187,91 @@ Você também pode usar msi em vez de `rustdesk.exe --silent-install`.
|
||||
|
||||
https://rustdesk.com/docs/en/client/windows/msi/
|
||||
|
||||
|
||||
### Winget
|
||||
|
||||
você pode implantar via powershell com winget também (isso instala via a versão da Microsoft do apt - parte das instalações mais recentes do Windows)
|
||||
|
||||
de uma janela do powershell ou via script (por exemplo via GPO)
|
||||
|
||||
```
|
||||
winget install --id=RustDesk.RustDesk -e
|
||||
```
|
||||
|
||||
### macOS Bash
|
||||
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# Define o valor da senha aleatória para a variável password
|
||||
# Atribuir o valor da senha aleatória à variável senha
|
||||
rustdesk_pw=$(openssl rand -hex 4)
|
||||
|
||||
# Preencha a string de configuração (configstring) obtida do portal web
|
||||
# Obtenha sua string de configuração do seu portal Web e preencha abaixo
|
||||
rustdesk_cfg="configstring"
|
||||
|
||||
################################### Por favor, não edite abaixo desta linha #########################################
|
||||
################################### Por favor não edite abaixo desta linha #########################################
|
||||
|
||||
# Verifica se o script está sendo executado como root
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Este script deve ser executado como root."
|
||||
exit 1
|
||||
fi
|
||||
# Solicitação de senha de root para elevação de privilégio
|
||||
[ "$UID" -eq 0 ] || exec sudo bash "$0" "$@"
|
||||
|
||||
# Define o caminho para o arquivo rustdesk.dmg
|
||||
dmg_file="/tmp/rustdesk-1.2.6-x86_64.dmg"
|
||||
|
||||
# Define o ponto de montagem para o DMG (diretório temporário)
|
||||
# Especificar o ponto de montagem para o DMG (diretório temporário)
|
||||
mount_point="/Volumes/RustDesk"
|
||||
|
||||
# Baixa o arquivo rustdesk.dmg
|
||||
echo "Baixando o RustDesk agora"
|
||||
# Baixar o arquivo rustdesk.dmg
|
||||
echo "Baixando RustDesk agora"
|
||||
|
||||
if [[ $(arch) == 'arm64' ]]; then
|
||||
curl -L https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-aarch64.dmg --output "$dmg_file"
|
||||
rd_link=$(curl -sL https://github.com/rustdesk/rustdesk/releases/latest | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*/\d{1}.\d{1,2}.\d{1,2}/rustdesk.\d{1}.\d{1,2}.\d{1,2}.aarch64.dmg")
|
||||
dmg_file=$(echo $rd_link | grep -Eo "rustdesk.\d{1}.\d{1,2}.\d{1,2}.aarch64.dmg")
|
||||
curl -L "$rd_link" --output "$dmg_file"
|
||||
else
|
||||
curl -L https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.dmg --output "$dmg_file"
|
||||
rd_link=$(curl -sL https://github.com/rustdesk/rustdesk/releases/latest | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*/\d{1}.\d{1,2}.\d{1,2}/rustdesk.\d{1}.\d{1,2}.\d{1,2}.x86_64.dmg")
|
||||
dmg_file=$(echo $rd_link | grep -Eo "rustdesk.\d{1}.\d{1,2}.\d{1,2}.x86_64.dmg")
|
||||
curl -L "$rd_link" --output "$dmg_file"
|
||||
fi
|
||||
|
||||
# Monta o arquivo DMG no ponto de montagem especificado
|
||||
# Montar o arquivo DMG no ponto de montagem especificado
|
||||
hdiutil attach "$dmg_file" -mountpoint "$mount_point" &> /dev/null
|
||||
|
||||
# Verifica se a montagem foi bem-sucedida
|
||||
# Verificar se a montagem foi bem-sucedida
|
||||
if [ $? -eq 0 ]; then
|
||||
# Move o conteúdo do DMG montado para a pasta /Applications
|
||||
# Mover o conteúdo do DMG montado para a pasta /Applications
|
||||
cp -R "$mount_point/RustDesk.app" "/Applications/" &> /dev/null
|
||||
|
||||
# Desmonta o arquivo DMG
|
||||
# Desmontar o arquivo DMG
|
||||
hdiutil detach "$mount_point" &> /dev/null
|
||||
else
|
||||
echo "Falha ao montar o DMG do RustDesk. Instalação abortada."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Executa o comando rustdesk com --get-id e armazena a saída na variável rustdesk_id
|
||||
# Executar o comando rustdesk com --get-id e armazenar a saída na variável rustdesk_id
|
||||
cd /Applications/RustDesk.app/Contents/MacOS/
|
||||
rustdesk_id=$(./RustDesk --get-id)
|
||||
|
||||
# Aplica a nova senha ao RustDesk
|
||||
# Aplicar nova senha ao RustDesk
|
||||
./RustDesk --server &
|
||||
/Applications/RustDesk.app/Contents/MacOS/RustDesk --password $rustdesk_pw &> /dev/null
|
||||
|
||||
/Applications/RustDesk.app/Contents/MacOS/RustDesk --config $rustdesk_cfg
|
||||
|
||||
# Kill all processes named RustDesk
|
||||
# Matar todos os processos chamados RustDesk
|
||||
rdpid=$(pgrep RustDesk)
|
||||
kill $rdpid &> /dev/null
|
||||
|
||||
echo "..............................................."
|
||||
# Check if the rustdesk_id is not empty
|
||||
# Verificar se rustdesk_id não está vazio
|
||||
if [ -n "$rustdesk_id" ]; then
|
||||
echo "RustDesk ID: $rustdesk_id"
|
||||
echo "ID RustDesk: $rustdesk_id"
|
||||
else
|
||||
echo "Failed to get RustDesk ID."
|
||||
echo "Falha ao obter o ID do RustDesk."
|
||||
fi
|
||||
|
||||
# Echo the value of the password variable
|
||||
echo "Password: $rustdesk_pw"
|
||||
# Mostrar o valor da variável senha
|
||||
echo "Senha: $rustdesk_pw"
|
||||
echo "..............................................."
|
||||
|
||||
echo "Please complete install on GUI, launching RustDesk now."
|
||||
echo "Por favor complete a instalação na GUI, lançando RustDesk agora."
|
||||
open -n /Applications/RustDesk.app
|
||||
```
|
||||
|
||||
@@ -271,21 +280,21 @@ open -n /Applications/RustDesk.app
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# Define um valor aleatório para a senha e armazena na variável password
|
||||
# Atribuir um valor aleatório à variável senha
|
||||
rustdesk_pw=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)
|
||||
|
||||
# Preencha a string de configuração (configstring) obtida do portal web
|
||||
# Obtenha sua string de configuração do seu portal Web e preencha abaixo
|
||||
rustdesk_cfg="configstring"
|
||||
|
||||
################################### Por favor, não edite abaixo desta linha #########################################
|
||||
################################### Por favor não edite abaixo desta linha #########################################
|
||||
|
||||
# Verifica se o script está sendo executado como root
|
||||
# Verificar se o script está sendo executado como root
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Este script deve ser executado como root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Identifica o Sistema Operacional (SO)
|
||||
# Identificar OS
|
||||
if [ -f /etc/os-release ]; then
|
||||
# freedesktop.org e systemd
|
||||
. /etc/os-release
|
||||
@@ -294,7 +303,7 @@ if [ -f /etc/os-release ]; then
|
||||
|
||||
UPSTREAM_ID=${ID_LIKE,,}
|
||||
|
||||
# Retorna para ID_LIKE se ID não for 'ubuntu' ou 'debian'
|
||||
# Retornar para ID_LIKE se ID não era 'ubuntu' ou 'debian'
|
||||
if [ "${UPSTREAM_ID}" != "debian" ] && [ "${UPSTREAM_ID}" != "ubuntu" ]; then
|
||||
UPSTREAM_ID="$(echo ${ID_LIKE,,} | sed s/\"//g | cut -d' ' -f1)"
|
||||
fi
|
||||
@@ -309,24 +318,24 @@ elif [ -f /etc/lsb-release ]; then
|
||||
OS=$DISTRIB_ID
|
||||
VER=$DISTRIB_RELEASE
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
# mais antigos Debian, Ubuntu, etc.
|
||||
# Debian mais antigo, Ubuntu, etc.
|
||||
OS=Debian
|
||||
VER=$(cat /etc/debian_version)
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
# mais antigos SuSE etc.
|
||||
# SuSE mais antigo etc.
|
||||
OS=SuSE
|
||||
VER=$(cat /etc/SuSE-release)
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
# mais antigos Red Hat, CentOS, etc.
|
||||
# Red Hat mais antigo, CentOS, etc.
|
||||
OS=RedHat
|
||||
VER=$(cat /etc/redhat-release)
|
||||
else
|
||||
# Retorna para uname, por exemplo, "Linux <versão>". Isso também funciona para BSD, etc.
|
||||
# Retornar para uname, ex. "Linux <version>", também funciona para BSD, etc.
|
||||
OS=$(uname -s)
|
||||
VER=$(uname -r)
|
||||
fi
|
||||
|
||||
# Instala o RustDesk
|
||||
# Instalar RustDesk
|
||||
|
||||
echo "Instalando RustDesk"
|
||||
if [ "${ID}" = "debian" ] || [ "$OS" = "Ubuntu" ] || [ "$OS" = "Debian" ] || [ "${UPSTREAM_ID}" = "ubuntu" ] || [ "${UPSTREAM_ID}" = "debian" ]; then
|
||||
@@ -336,17 +345,17 @@ elif [ "$OS" = "CentOS" ] || [ "$OS" = "RedHat" ] || [ "$OS" = "Fedora Linux" ]
|
||||
wget https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-0.x86_64.rpm
|
||||
yum localinstall ./rustdesk-1.2.6-0.x86_64.rpm -y > null
|
||||
else
|
||||
echo "Sistema operacional não suportado"
|
||||
# Aqui você poderia pedir permissão ao usuário para tentar instalar mesmo assim
|
||||
echo "SO não suportado"
|
||||
# aqui você pode perguntar ao usuário permissão para tentar instalar mesmo assim
|
||||
# se eles disserem sim, então faça a instalação
|
||||
# se eles disserem não, saia do script
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Executa o comando rustdesk com --get-id e armazena a saída na variável rustdesk_id
|
||||
# Executar o comando rustdesk com --get-id e armazenar a saída na variável rustdesk_id
|
||||
rustdesk_id=$(rustdesk --get-id)
|
||||
|
||||
# Aplica a nova senha ao RustDesk
|
||||
# Aplicar nova senha ao RustDesk
|
||||
rustdesk --password $rustdesk_pw &> /dev/null
|
||||
|
||||
rustdesk --config $rustdesk_cfg
|
||||
@@ -354,14 +363,14 @@ rustdesk --config $rustdesk_cfg
|
||||
systemctl restart rustdesk
|
||||
|
||||
echo "..............................................."
|
||||
# Verifica se o rustdesk_id não está vazio
|
||||
# Verificar se rustdesk_id não está vazio
|
||||
if [ -n "$rustdesk_id" ]; then
|
||||
echo "RustDesk ID: $rustdesk_id"
|
||||
echo "ID RustDesk: $rustdesk_id"
|
||||
else
|
||||
echo "Falha para pegar RustDesk ID."
|
||||
echo "Falha ao obter o ID do RustDesk."
|
||||
fi
|
||||
|
||||
# Exiba o valor da variável de senha
|
||||
echo "Password: $rustdesk_pw"
|
||||
# Mostrar o valor da variável senha
|
||||
echo "Senha: $rustdesk_pw"
|
||||
echo "..............................................."
|
||||
```
|
||||
```
|
||||
@@ -1,330 +0,0 @@
|
||||
---
|
||||
title: Client Deployment
|
||||
weight: 400
|
||||
pre: "<b>2.4. </b>"
|
||||
---
|
||||
|
||||
Aşağıdaki yöntemlerden birini kullanarak dağıtım yapabilirsiniz. Bazıları [Client](/docs/en/self-host/client-configuration/) bölümünde ele alınmıştır.
|
||||
|
||||
Alternatif olarak, RMM, intune vb. ile kütle dağıtım komut dosyaları da kullanabilirsiniz. Kimlik ve şifre komut dosyası tarafından üretilir, bunu toplamalısınız veya kimlik ve şifreyi toplamak için farklı komut dosyalarına bölmelisiniz.
|
||||
|
||||
Kalıcı şifreyi rastgele değerden tercih ettiğiniz bir şifreye değiştirmek için, rustdesk_pw'in içindeki () içeriğini tercih ettiğiniz şifreyle değiştirerek yapabilirsiniz.
|
||||
|
||||
### Powershell
|
||||
|
||||
```ps
|
||||
$ErrorActionPreference= 'silentlycontinue'
|
||||
|
||||
# Şifre değişkenine rastgele bir şifre atayın
|
||||
$rustdesk_pw = (-join ((65..90) + (97..122) | Get-Random -Count 12 | % {[char]$_}))
|
||||
|
||||
# Web portalından yapılandırma dizgesini alın ve aşağıdaki alanı doldurun.
|
||||
rustdesk_cfg="configstring"
|
||||
|
||||
####################################Lütfen Aşağıdaki Satırı Düzenlemeyin##########################################
|
||||
|
||||
# Yönetici olarak çalıştırın ve geçerli dizinde kalır
|
||||
if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
|
||||
Start-Process PowerShell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";
|
||||
Exit;
|
||||
}
|
||||
}
|
||||
|
||||
# Bu fonksiyon en son sürüm numarasını ve indirme bağlantısını bir nesne olarak döndürür
|
||||
function getLatest()
|
||||
{
|
||||
$Page = Invoke-WebRequest -Uri 'https://github.com/rustdesk/rustdesk/releases/latest' -UseBasicParsing
|
||||
$HTML = New-Object -Com "HTMLFile"
|
||||
try
|
||||
{
|
||||
$HTML.IHTMLDocument2_write($Page.Content)
|
||||
}
|
||||
catch
|
||||
{
|
||||
$src = [System.Text.Encoding]::Unicode.GetBytes($Page.Content)
|
||||
$HTML.write($src)
|
||||
}
|
||||
|
||||
# Güncel örnek linki: https://github.com/rustdesk/rustdesk/releases/download/1.2.3/rustdesk-1.2.3-x86_64.exe
|
||||
$Downloadlink = ($HTML.Links | Where {$_.href -match '(.)+\/rustdesk\/rustdesk\/releases\/download\/\d{1}.\d{1,2}.\d{1,2}(.{0,3})\/rustdesk(.)+x86_64.exe'} | select -first 1).href
|
||||
|
||||
# bugfix - Bazen "about:" kısmını değiştirmeniz gerekir.
|
||||
$Downloadlink = $Downloadlink.Replace('about:', 'https://github.com')
|
||||
|
||||
$Version = "unknown"
|
||||
if ($Downloadlink -match './rustdesk/rustdesk/releases/download/(?<content>.*)/rustdesk-(.)+x86_64.exe')
|
||||
{
|
||||
$Version = $matches['content']
|
||||
}
|
||||
|
||||
if ($Version -eq "unknown" -or $Downloadlink -eq "")
|
||||
{
|
||||
Write-Output "HATA: Sürüm veya indirme bağlantısı bulunamadı."
|
||||
Exit
|
||||
}
|
||||
|
||||
# Zurückgebendes Objekt erstellen
|
||||
$Result = New-Object PSObject -Property
|
||||
@{
|
||||
Version = $Version
|
||||
Downloadlink = $Downloadlink
|
||||
}
|
||||
|
||||
return($Result)
|
||||
}
|
||||
|
||||
$RustDeskOnGitHub = getLatest
|
||||
|
||||
$rdver = ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RustDesk\").Version)
|
||||
|
||||
if($rdver -eq $RustDeskOnGitHub.Version)
|
||||
{
|
||||
write-output "RustDesk $rdver en yeni sürüm"
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
If (!(Test-Path c:\Temp)) {
|
||||
New-Item -ItemType Directory -Force -Path c:\Temp > null
|
||||
}
|
||||
|
||||
cd c:\Temp
|
||||
|
||||
powershell Invoke-WebRequest $RustDeskOnGitHub.Downloadlink -Outfile "rustdesk.exe"
|
||||
Start-Process .\rustdesk.exe --silent-install
|
||||
Start-Sleep -seconds 20
|
||||
|
||||
$ServiceName = 'Rustdesk'
|
||||
$arrService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
|
||||
|
||||
if ($arrService -eq $null)
|
||||
{
|
||||
Write-Output "Hizmetin yüklenmesi"
|
||||
cd $env:ProgramFiles\RustDesk
|
||||
Start-Process .\rustdesk.exe --install-service
|
||||
Start-Sleep -seconds 20
|
||||
$arrService = Get-Service -Name $ServiceName
|
||||
}
|
||||
|
||||
while ($arrService.Status -ne 'Running')
|
||||
{
|
||||
Start-Service $ServiceName
|
||||
Start-Sleep -seconds 5
|
||||
$arrService.Refresh()
|
||||
}
|
||||
|
||||
cd $env:ProgramFiles\RustDesk\
|
||||
$rustdesk_id = (.\RustDesk.exe --get-id | out-host)
|
||||
|
||||
net stop rustdesk > null
|
||||
.\RustDesk.exe --config $rustdesk_cfg
|
||||
|
||||
$ProcessActive = Get-Process rustdesk -ErrorAction SilentlyContinue
|
||||
if($ProcessActive -ne $null)
|
||||
{
|
||||
stop-process -ProcessName rustdesk -Force
|
||||
}
|
||||
|
||||
Start-Process "$env:ProgramFiles\RustDesk\RustDesk.exe" "--password $rustdesk_pw" -wait
|
||||
|
||||
Write-Output "..............................................."
|
||||
# Kimlik Değişkeninin değerini gösterin
|
||||
Write-Output "RustDesk Kimlik: $rustdesk_id"
|
||||
|
||||
# Şifre Değişkeninin değerini gösterin
|
||||
Write-Output "Şifre: $rustdesk_pw"
|
||||
Write-Output "..............................................."
|
||||
```
|
||||
|
||||
|
||||
### Mac OS Bash
|
||||
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# Şifre değişkenine rastgele bir şifre atayın
|
||||
rustdesk_pw=$(openssl rand -hex 4)
|
||||
|
||||
# Web portalından yapılandırma dizgesini alın ve aşağıdaki alanı doldurun.
|
||||
rustdesk_cfg="configstring"
|
||||
|
||||
####################################Lütfen Aşağıdaki Satırı Düzenlemeyin##########################################
|
||||
|
||||
# Skriptin kök olarak çalıştırılıp çalıştırılmadığını kontrol edin
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "
|
||||
|
||||
Bu komut dosyası kök olarak çalıştırılmalıdır."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# rustdesk.dmg dosyasının yolunu belirtin
|
||||
dmg_file="/tmp/rustdesk-1.2.2-x86_64.dmg"
|
||||
|
||||
# DMG için bağlama noktasını belirtin (geçici dizin)
|
||||
mount_point="/Volumes/RustDesk"
|
||||
|
||||
# rustdesk.dmg dosyasını indirin
|
||||
echo "RustDesk İndiriliyor"
|
||||
|
||||
if [[ $(arch) == 'arm64' ]]; then
|
||||
curl -L https://github.com/rustdesk/rustdesk/releases/download/1.2.2/rustdesk-1.2.2-aarch64.dmg --output "$dmg_file"
|
||||
else
|
||||
curl -L https://github.com/rustdesk/rustdesk/releases/download/1.2.2/rustdesk-1.2.2-x86_64.dmg --output "$dmg_file"
|
||||
fi
|
||||
|
||||
# DMG dosyasını belirtilen bağlama noktasına bağla
|
||||
hdiutil attach "$dmg_file" -mountpoint "$mount_point" &> /dev/null
|
||||
|
||||
# Bağlama işleminin başarılı olup olmadığını kontrol edin
|
||||
if [ $? -eq 0 ]; then
|
||||
# Bağlanan DMG'nin içeriğini /Applications klasörüne kopyalayın
|
||||
cp -R "$mount_point/RustDesk.app" "/Applications/" &> /dev/null
|
||||
|
||||
# DMG dosyasını bağlamayı kaldırın
|
||||
hdiutil detach "$mount_point" &> /dev/null
|
||||
else
|
||||
echo "RustDesk DMG'si bağlanamadı. Kurulum iptal edildi."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# rustdesk komutunu --get-id ile çalıştırın ve çıktıyı rustdesk_id değişkenine kaydedin
|
||||
cd /Applications/RustDesk.app/Contents/MacOS/
|
||||
rustdesk_id=$(./RustDesk --get-id)
|
||||
|
||||
# Yeni şifreyi RustDesk'e uygulayın
|
||||
./RustDesk --server &
|
||||
/Applications/RustDesk.app/Contents/MacOS/RustDesk --password $rustdesk_pw &> /dev/null
|
||||
|
||||
/Applications/RustDesk.app/Contents/MacOS/RustDesk --config $rustdesk_cfg
|
||||
|
||||
# Tüm RustDesk adlı işlemleri sonlandırın
|
||||
rdpid=$(pgrep RustDesk)
|
||||
kill $rdpid &> /dev/null
|
||||
|
||||
echo "..............................................."
|
||||
# rustdesk_id boş değilse kontrol edin
|
||||
if [ -n "$rustdesk_id" ]; then
|
||||
echo "RustDesk Kimlik: $rustdesk_id"
|
||||
else
|
||||
echo "RustDesk Kimlik alınamadı."
|
||||
fi
|
||||
|
||||
# Şifre değişkeninin değerini yazdırın
|
||||
echo "Şifre: $rustdesk_pw"
|
||||
echo "..............................................."
|
||||
|
||||
echo "Lütfen kurulumu GUI üzerinde tamamlayın, RustDesk'i şimdi başlatıyorum."
|
||||
open -n /Applications/RustDesk.app
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# Rastgele bir değer atayarak şifre değişkenine atayın
|
||||
rustdesk_pw=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)
|
||||
|
||||
|
||||
# Web portalından yapılandırma dizgesini alın ve aşağıdaki alanı doldurun.
|
||||
rustdesk_cfg="encryptedconfigstring"
|
||||
|
||||
####################################Lütfen Aşağıdaki Satırı Düzenlemeyin##########################################
|
||||
|
||||
# Skriptin kök olarak çalıştırılıp çalıştırılmadığını kontrol edin
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Bu komut dosyası kök olarak çalıştırılmalıdır."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# İşletim sistemini belirleyin
|
||||
if [ -f /etc/os-release ]; then
|
||||
# freedesktop.org ve systemd
|
||||
. /etc/os-release
|
||||
OS=$NAME
|
||||
VER=$VERSION_ID
|
||||
|
||||
UPSTREAM_ID=${ID_LIKE,,}
|
||||
|
||||
# Fallback to ID_LIKE if ID was not 'ubuntu' or 'debian'
|
||||
if [ "${UPSTREAM_ID}" != "debian" ] && [ "${UPSTREAM_ID}" != "ubuntu" ]; then
|
||||
UPSTREAM_ID="$(echo ${ID_LIKE,,} | sed s/\"//g | cut -d' ' -f1)"
|
||||
fi
|
||||
|
||||
|
||||
elif type lsb_release >/dev/null 2>&1; then
|
||||
# linuxbase.org
|
||||
OS=$(lsb_release -si)
|
||||
VER=$(lsb_release -sr)
|
||||
elif [ -f /etc/lsb-release ]; then
|
||||
# For some versions of Debian/Ubuntu without lsb_release command
|
||||
. /etc/lsb-release
|
||||
OS=$DISTRIB_ID
|
||||
VER=$DISTRIB_RELEASE
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
# Older Debian/Ubuntu/etc.
|
||||
OS=Debian
|
||||
VER=$(cat /etc/debian_version)
|
||||
elif [ -f /etc/SuSe-release ]; then
|
||||
# Older SuSE/etc.
|
||||
OS=SuSE
|
||||
VER=$(cat /etc/SuSe-release)
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
# Older Red Hat, CentOS, etc.
|
||||
OS=RedHat
|
||||
VER=$(cat /etc/redhat-release)
|
||||
else
|
||||
# Fall back to uname, e.g. "Linux <version>", also works for BSD, etc.
|
||||
OS=$(uname -s)
|
||||
VER=$(uname -r)
|
||||
fi
|
||||
|
||||
# Rustdesk'i Yükle
|
||||
|
||||
echo "Rustdesk Yükleniyor"
|
||||
if [ "${ID}" = "debian" ] || [ "$OS" = "Ubuntu" ] || [ "$OS" = "Debian" ] || [ "${UPSTREAM_ID}" = "ubuntu" ] || [ "${UPSTREAM_ID}" = "debian" ]; then
|
||||
wget https://github.com/rustdesk/rustdesk/releases/download/1.2.2/rustdesk-1.2.2-x86_64.deb
|
||||
apt-get install -fy ./rustdesk-1.2.2-x86_64.deb > null
|
||||
elif [ "$OS" = "CentOS" ] || [ "$OS" = "RedHat" ] || [ "$OS" = "Fedora Linux" ] || [ "${UPSTREAM_ID}" = "rhel" ] ; then
|
||||
wget https://github.com/rustdesk/rustdesk/releases/download/1.2.2/rustdesk-1.2.2-0.x86_64.rpm
|
||||
yum localinstall ./rustdesk-1.2.2-0.x86_64.rpm -y > null
|
||||
else
|
||||
echo "Desteklenmeyen İşletim Sistemi"
|
||||
# burada kullanıcı
|
||||
|
||||
dan yine de kurulumu denemek için izin isteyebilirsiniz
|
||||
# eğer evet derlerse, kurulumu yapın
|
||||
# eğer hayır derlerse, komut dosyasını sonlandırın
|
||||
exit 1
|
||||
fi
|
||||
|
||||
systemctl stop rustdesk
|
||||
|
||||
# rustdesk komutunu --get-id ile çalıştırın ve çıktıyı rustdesk_id değişkenine kaydedin
|
||||
rustdesk_id=$(rustdesk --get-id)
|
||||
|
||||
# Yeni şifreyi RustDesk'e uygulayın
|
||||
systemctl start rustdesk
|
||||
rustdesk --password $rustdesk_pw &> /dev/null
|
||||
|
||||
rustdesk --config $rustdesk_cfg
|
||||
|
||||
systemctl restart rustdesk
|
||||
|
||||
|
||||
echo "..............................................."
|
||||
# rustdesk_id boş değilse kontrol edin
|
||||
if [ -n "$rustdesk_id" ]; then
|
||||
echo "RustDesk Kimlik: $rustdesk_id"
|
||||
else
|
||||
echo "RustDesk Kimlik alınamadı."
|
||||
fi
|
||||
|
||||
# Şifre değişkeninin değerini yazdırın
|
||||
echo "Şifre: $rustdesk_password"
|
||||
echo "..............................................."
|
||||
```
|
||||
|
||||
Bu komut dosyaları, RustDesk'in farklı işletim sistemlerine dağıtımını gerçekleştirmek için tasarlanmıştır. Her bir komut dosyası belirli bir işletim sistemi için uygundur ve RustDesk'in yüklenmesini, yapılandırılmasını ve çalıştırılmasını otomatikleştirmektedir.
|
||||
376
content/self-host/client-deployment/_index.zh-cn.md
Normal file
376
content/self-host/client-deployment/_index.zh-cn.md
Normal file
@@ -0,0 +1,376 @@
|
||||
---
|
||||
title: 客户端部署
|
||||
weight: 400
|
||||
pre: "<b>2.4. </b>"
|
||||
---
|
||||
|
||||
最简单的方法是使用自定义客户端,https://twitter.com/rustdesk/status/1788905463678951787。
|
||||
|
||||
您可以使用多种方法进行部署,其中一些在[客户端配置](https://rustdesk.com/docs/en/self-host/client-configuration/)中有介绍。
|
||||
|
||||
或者,您可以通过 RMM、Intune 等使用批量部署脚本。ID 和密码由脚本输出。您应该收集这些信息或将其拆分为不同的脚本来收集 ID 和密码。
|
||||
|
||||
可以通过将 `rustdesk_pw` 后面 `()` 内的内容更改为您首选的密码来将永久密码从随机更改为您首选的密码,这适用于 PowerShell,其他平台的相应行也是如此。
|
||||
|
||||
### PowerShell
|
||||
|
||||
```powershell
|
||||
$ErrorActionPreference= 'silentlycontinue'
|
||||
|
||||
# 为密码变量分配随机密码值
|
||||
$rustdesk_pw=(-join ((65..90) + (97..122) | Get-Random -Count 12 | % {[char]$_}))
|
||||
|
||||
# 从您的 Web 门户获取配置字符串并填写下面
|
||||
$rustdesk_cfg="configstring"
|
||||
|
||||
################################### 请不要编辑此行以下的内容 #########################################
|
||||
|
||||
# 以管理员身份运行并保持在当前目录
|
||||
if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
|
||||
{
|
||||
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000)
|
||||
{
|
||||
Start-Process PowerShell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";
|
||||
Exit;
|
||||
}
|
||||
}
|
||||
|
||||
# 此函数将返回最新版本和下载链接作为对象
|
||||
function getLatest()
|
||||
{
|
||||
$Page = Invoke-WebRequest -Uri 'https://github.com/rustdesk/rustdesk/releases/latest' -UseBasicParsing
|
||||
$HTML = New-Object -Com "HTMLFile"
|
||||
try
|
||||
{
|
||||
$HTML.IHTMLDocument2_write($Page.Content)
|
||||
}
|
||||
catch
|
||||
{
|
||||
$src = [System.Text.Encoding]::Unicode.GetBytes($Page.Content)
|
||||
$HTML.write($src)
|
||||
}
|
||||
|
||||
# 当前示例链接: https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.exe
|
||||
$Downloadlink = ($HTML.Links | Where {$_.href -match '(.)+\/rustdesk\/rustdesk\/releases\/download\/\d{1}.\d{1,2}.\d{1,2}(.{0,3})\/rustdesk(.)+x86_64.exe'} | select -first 1).href
|
||||
|
||||
# 错误修复 - 有时需要替换 "about:"
|
||||
$Downloadlink = $Downloadlink.Replace('about:', 'https://github.com')
|
||||
|
||||
$Version = "unknown"
|
||||
if ($Downloadlink -match './rustdesk/rustdesk/releases/download/(?<content>.*)/rustdesk-(.)+x86_64.exe')
|
||||
{
|
||||
$Version = $matches['content']
|
||||
}
|
||||
|
||||
if ($Version -eq "unknown" -or $Downloadlink -eq "")
|
||||
{
|
||||
Write-Output "错误:未找到版本或下载链接。"
|
||||
Exit
|
||||
}
|
||||
|
||||
# 创建要返回的对象
|
||||
$params += @{Version = $Version}
|
||||
$params += @{Downloadlink = $Downloadlink}
|
||||
$Result = New-Object PSObject -Property $params
|
||||
|
||||
return($Result)
|
||||
}
|
||||
|
||||
$RustDeskOnGitHub = getLatest
|
||||
|
||||
|
||||
$rdver = ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RustDesk\").Version)
|
||||
|
||||
if ($rdver -eq $RustDeskOnGitHub.Version)
|
||||
{
|
||||
Write-Output "RustDesk $rdver 是最新版本。"
|
||||
Exit
|
||||
}
|
||||
|
||||
if (!(Test-Path C:\Temp))
|
||||
{
|
||||
New-Item -ItemType Directory -Force -Path C:\Temp | Out-Null
|
||||
}
|
||||
|
||||
cd C:\Temp
|
||||
|
||||
Invoke-WebRequest $RustDeskOnGitHub.Downloadlink -Outfile "rustdesk.exe"
|
||||
Start-Process .\rustdesk.exe --silent-install
|
||||
Start-Sleep -seconds 20
|
||||
|
||||
$ServiceName = 'Rustdesk'
|
||||
$arrService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
|
||||
|
||||
if ($arrService -eq $null)
|
||||
{
|
||||
Write-Output "正在安装服务"
|
||||
cd $env:ProgramFiles\RustDesk
|
||||
Start-Process .\rustdesk.exe --install-service
|
||||
Start-Sleep -seconds 20
|
||||
$arrService = Get-Service -Name $ServiceName
|
||||
}
|
||||
|
||||
while ($arrService.Status -ne 'Running')
|
||||
{
|
||||
Start-Service $ServiceName
|
||||
Start-Sleep -seconds 5
|
||||
$arrService.Refresh()
|
||||
}
|
||||
|
||||
cd $env:ProgramFiles\RustDesk\
|
||||
.\rustdesk.exe --get-id | Write-Output -OutVariable rustdesk_id
|
||||
|
||||
.\rustdesk.exe --config $rustdesk_cfg
|
||||
|
||||
.\rustdesk.exe --password $rustdesk_pw
|
||||
|
||||
Write-Output "..............................................."
|
||||
# 显示 ID 变量的值
|
||||
Write-Output "RustDesk ID: $rustdesk_id"
|
||||
|
||||
# 显示密码变量的值
|
||||
Write-Output "密码: $rustdesk_pw"
|
||||
Write-Output "..............................................."
|
||||
```
|
||||
|
||||
### Windows 批处理/cmd
|
||||
|
||||
```bat
|
||||
@echo off
|
||||
|
||||
REM 为密码变量分配随机密码值
|
||||
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
|
||||
set alfanum=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
|
||||
set rustdesk_pw=
|
||||
for /L %%b in (1, 1, 12) do (
|
||||
set /A rnd_num=!RANDOM! %% 62
|
||||
for %%c in (!rnd_num!) do (
|
||||
set rustdesk_pw=!rustdesk_pw!!alfanum:~%%c,1!
|
||||
)
|
||||
)
|
||||
|
||||
REM 从您的 Web 门户获取配置字符串并填写下面
|
||||
set rustdesk_cfg="configstring"
|
||||
|
||||
REM ############################### 请不要编辑此行以下的内容 #########################################
|
||||
|
||||
if not exist C:\Temp\ md C:\Temp\
|
||||
cd C:\Temp\
|
||||
|
||||
curl -L "https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.exe" -o rustdesk.exe
|
||||
|
||||
rustdesk.exe --silent-install
|
||||
timeout /t 20
|
||||
|
||||
cd "C:\Program Files\RustDesk\"
|
||||
rustdesk.exe --install-service
|
||||
timeout /t 20
|
||||
|
||||
for /f "delims=" %%i in ('rustdesk.exe --get-id ^| more') do set rustdesk_id=%%i
|
||||
|
||||
rustdesk.exe --config %rustdesk_cfg%
|
||||
|
||||
rustdesk.exe --password %rustdesk_pw%
|
||||
|
||||
echo ...............................................
|
||||
REM 显示 ID 变量的值
|
||||
echo RustDesk ID: %rustdesk_id%
|
||||
|
||||
REM 显示密码变量的值
|
||||
echo 密码: %rustdesk_pw%
|
||||
echo ...............................................
|
||||
```
|
||||
|
||||
### MSI
|
||||
|
||||
您也可以使用 msi 而不是 `rustdesk.exe --silent-install`。
|
||||
|
||||
https://rustdesk.com/docs/en/client/windows/msi/
|
||||
|
||||
|
||||
### Winget
|
||||
|
||||
您也可以通过 powershell 使用 winget 进行部署(这通过微软版本的 apt 安装 - 大多数最新 Windows 安装的一部分)
|
||||
|
||||
从 powershell 窗口或通过脚本(例如通过 GPO)
|
||||
|
||||
```
|
||||
winget install --id=RustDesk.RustDesk -e
|
||||
```
|
||||
|
||||
### macOS Bash
|
||||
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# 为密码变量分配随机密码值
|
||||
rustdesk_pw=$(openssl rand -hex 4)
|
||||
|
||||
# 从您的 Web 门户获取配置字符串并填写下面
|
||||
rustdesk_cfg="configstring"
|
||||
|
||||
################################### 请不要编辑此行以下的内容 #########################################
|
||||
|
||||
# 请求 root 密码以进行权限提升
|
||||
[ "$UID" -eq 0 ] || exec sudo bash "$0" "$@"
|
||||
|
||||
# 指定 DMG 的挂载点(临时目录)
|
||||
mount_point="/Volumes/RustDesk"
|
||||
|
||||
# 下载 rustdesk.dmg 文件
|
||||
echo "正在下载 RustDesk"
|
||||
|
||||
if [[ $(arch) == 'arm64' ]]; then
|
||||
rd_link=$(curl -sL https://github.com/rustdesk/rustdesk/releases/latest | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*/\d{1}.\d{1,2}.\d{1,2}/rustdesk.\d{1}.\d{1,2}.\d{1,2}.aarch64.dmg")
|
||||
dmg_file=$(echo $rd_link | grep -Eo "rustdesk.\d{1}.\d{1,2}.\d{1,2}.aarch64.dmg")
|
||||
curl -L "$rd_link" --output "$dmg_file"
|
||||
else
|
||||
rd_link=$(curl -sL https://github.com/rustdesk/rustdesk/releases/latest | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*/\d{1}.\d{1,2}.\d{1,2}/rustdesk.\d{1}.\d{1,2}.\d{1,2}.x86_64.dmg")
|
||||
dmg_file=$(echo $rd_link | grep -Eo "rustdesk.\d{1}.\d{1,2}.\d{1,2}.x86_64.dmg")
|
||||
curl -L "$rd_link" --output "$dmg_file"
|
||||
fi
|
||||
|
||||
# 将 DMG 文件挂载到指定的挂载点
|
||||
hdiutil attach "$dmg_file" -mountpoint "$mount_point" &> /dev/null
|
||||
|
||||
# 检查挂载是否成功
|
||||
if [ $? -eq 0 ]; then
|
||||
# 将挂载的 DMG 内容移动到 /Applications 文件夹
|
||||
cp -R "$mount_point/RustDesk.app" "/Applications/" &> /dev/null
|
||||
|
||||
# 卸载 DMG 文件
|
||||
hdiutil detach "$mount_point" &> /dev/null
|
||||
else
|
||||
echo "挂载 RustDesk DMG 失败。安装中止。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 运行 rustdesk 命令带 --get-id 并将输出存储在 rustdesk_id 变量中
|
||||
cd /Applications/RustDesk.app/Contents/MacOS/
|
||||
rustdesk_id=$(./RustDesk --get-id)
|
||||
|
||||
# 为 RustDesk 应用新密码
|
||||
./RustDesk --server &
|
||||
/Applications/RustDesk.app/Contents/MacOS/RustDesk --password $rustdesk_pw &> /dev/null
|
||||
|
||||
/Applications/RustDesk.app/Contents/MacOS/RustDesk --config $rustdesk_cfg
|
||||
|
||||
# 终止所有名为 RustDesk 的进程
|
||||
rdpid=$(pgrep RustDesk)
|
||||
kill $rdpid &> /dev/null
|
||||
|
||||
echo "..............................................."
|
||||
# 检查 rustdesk_id 是否不为空
|
||||
if [ -n "$rustdesk_id" ]; then
|
||||
echo "RustDesk ID: $rustdesk_id"
|
||||
else
|
||||
echo "获取 RustDesk ID 失败。"
|
||||
fi
|
||||
|
||||
# 回显密码变量的值
|
||||
echo "密码: $rustdesk_pw"
|
||||
echo "..............................................."
|
||||
|
||||
echo "请在 GUI 上完成安装,现在启动 RustDesk。"
|
||||
open -n /Applications/RustDesk.app
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# 为密码变量分配随机值
|
||||
rustdesk_pw=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)
|
||||
|
||||
# 从您的 Web 门户获取配置字符串并填写下面
|
||||
rustdesk_cfg="configstring"
|
||||
|
||||
################################### 请不要编辑此行以下的内容 #########################################
|
||||
|
||||
# 检查脚本是否以 root 身份运行
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "此脚本必须以 root 身份运行。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 识别操作系统
|
||||
if [ -f /etc/os-release ]; then
|
||||
# freedesktop.org 和 systemd
|
||||
. /etc/os-release
|
||||
OS=$NAME
|
||||
VER=$VERSION_ID
|
||||
|
||||
UPSTREAM_ID=${ID_LIKE,,}
|
||||
|
||||
# 如果 ID 不是 'ubuntu' 或 'debian',则回退到 ID_LIKE
|
||||
if [ "${UPSTREAM_ID}" != "debian" ] && [ "${UPSTREAM_ID}" != "ubuntu" ]; then
|
||||
UPSTREAM_ID="$(echo ${ID_LIKE,,} | sed s/\"//g | cut -d' ' -f1)"
|
||||
fi
|
||||
|
||||
elif type lsb_release >/dev/null 2>&1; then
|
||||
# linuxbase.org
|
||||
OS=$(lsb_release -si)
|
||||
VER=$(lsb_release -sr)
|
||||
elif [ -f /etc/lsb-release ]; then
|
||||
# 对于一些没有 lsb_release 命令的 Debian/Ubuntu 版本
|
||||
. /etc/lsb-release
|
||||
OS=$DISTRIB_ID
|
||||
VER=$DISTRIB_RELEASE
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
# 较旧的 Debian、Ubuntu 等
|
||||
OS=Debian
|
||||
VER=$(cat /etc/debian_version)
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
# 较旧的 SuSE 等
|
||||
OS=SuSE
|
||||
VER=$(cat /etc/SuSE-release)
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
# 较旧的 Red Hat、CentOS 等
|
||||
OS=RedHat
|
||||
VER=$(cat /etc/redhat-release)
|
||||
else
|
||||
# 回退到 uname,例如 "Linux <version>",也适用于 BSD 等
|
||||
OS=$(uname -s)
|
||||
VER=$(uname -r)
|
||||
fi
|
||||
|
||||
# 安装 RustDesk
|
||||
|
||||
echo "正在安装 RustDesk"
|
||||
if [ "${ID}" = "debian" ] || [ "$OS" = "Ubuntu" ] || [ "$OS" = "Debian" ] || [ "${UPSTREAM_ID}" = "ubuntu" ] || [ "${UPSTREAM_ID}" = "debian" ]; then
|
||||
wget https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.deb
|
||||
apt-get install -fy ./rustdesk-1.2.6-x86_64.deb > null
|
||||
elif [ "$OS" = "CentOS" ] || [ "$OS" = "RedHat" ] || [ "$OS" = "Fedora Linux" ] || [ "${UPSTREAM_ID}" = "rhel" ] || [ "$OS" = "Almalinux" ] || [ "$OS" = "Rocky*" ] ; then
|
||||
wget https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-0.x86_64.rpm
|
||||
yum localinstall ./rustdesk-1.2.6-0.x86_64.rpm -y > null
|
||||
else
|
||||
echo "不支持的操作系统"
|
||||
# 这里您可以询问用户是否允许尝试安装
|
||||
# 如果他们说是,则进行安装
|
||||
# 如果他们说否,退出脚本
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 运行 rustdesk 命令带 --get-id 并将输出存储在 rustdesk_id 变量中
|
||||
rustdesk_id=$(rustdesk --get-id)
|
||||
|
||||
# 为 RustDesk 应用新密码
|
||||
rustdesk --password $rustdesk_pw &> /dev/null
|
||||
|
||||
rustdesk --config $rustdesk_cfg
|
||||
|
||||
systemctl restart rustdesk
|
||||
|
||||
echo "..............................................."
|
||||
# 检查 rustdesk_id 是否不为空
|
||||
if [ -n "$rustdesk_id" ]; then
|
||||
echo "RustDesk ID: $rustdesk_id"
|
||||
else
|
||||
echo "获取 RustDesk ID 失败。"
|
||||
fi
|
||||
|
||||
# 回显密码变量的值
|
||||
echo "密码: $rustdesk_pw"
|
||||
echo "..............................................."
|
||||
```
|
||||
376
content/self-host/client-deployment/_index.zh-tw.md
Normal file
376
content/self-host/client-deployment/_index.zh-tw.md
Normal file
@@ -0,0 +1,376 @@
|
||||
---
|
||||
title: 客戶端部署
|
||||
weight: 400
|
||||
pre: "<b>2.4. </b>"
|
||||
---
|
||||
|
||||
最簡單的方法是使用自訂客戶端,https://twitter.com/rustdesk/status/1788905463678951787。
|
||||
|
||||
您可以使用多種方法進行部署,其中一些方法在[客戶端配置](https://rustdesk.com/docs/en/self-host/client-configuration/)中有所涵蓋。
|
||||
|
||||
或者,您可以在 RMM、Intune 等系統中使用大量部署腳本。腳本會輸出 ID 和密碼。您應該收集這些資訊或將其分割到不同的腳本中以收集 ID 和密碼。
|
||||
|
||||
永久密碼可以透過修改 PowerShell 中 `rustdesk_pw` 後面的 `()` 中的內容,以及其他平台相應行的內容,從隨機密碼更改為您偏好的密碼。
|
||||
|
||||
### PowerShell
|
||||
|
||||
```powershell
|
||||
$ErrorActionPreference= 'silentlycontinue'
|
||||
|
||||
# 為密碼變數分配隨機密碼值
|
||||
$rustdesk_pw=(-join ((65..90) + (97..122) | Get-Random -Count 12 | % {[char]$_}))
|
||||
|
||||
# 從您的 Web 門戶獲取配置字串並填入以下位置
|
||||
$rustdesk_cfg="configstring"
|
||||
|
||||
################################### 請勿編輯此行以下的內容 #########################################
|
||||
|
||||
# 以管理員身份執行並保持在目前目錄
|
||||
if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
|
||||
{
|
||||
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000)
|
||||
{
|
||||
Start-Process PowerShell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";
|
||||
Exit;
|
||||
}
|
||||
}
|
||||
|
||||
# 此函數會將最新版本和下載連結作為物件回傳
|
||||
function getLatest()
|
||||
{
|
||||
$Page = Invoke-WebRequest -Uri 'https://github.com/rustdesk/rustdesk/releases/latest' -UseBasicParsing
|
||||
$HTML = New-Object -Com "HTMLFile"
|
||||
try
|
||||
{
|
||||
$HTML.IHTMLDocument2_write($Page.Content)
|
||||
}
|
||||
catch
|
||||
{
|
||||
$src = [System.Text.Encoding]::Unicode.GetBytes($Page.Content)
|
||||
$HTML.write($src)
|
||||
}
|
||||
|
||||
# 目前範例連結:https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.exe
|
||||
$Downloadlink = ($HTML.Links | Where {$_.href -match '(.)+\/rustdesk\/rustdesk\/releases\/download\/\d{1}.\d{1,2}.\d{1,2}(.{0,3})\/rustdesk(.)+x86_64.exe'} | select -first 1).href
|
||||
|
||||
# 錯誤修復 - 有時您需要替換 "about:"
|
||||
$Downloadlink = $Downloadlink.Replace('about:', 'https://github.com')
|
||||
|
||||
$Version = "unknown"
|
||||
if ($Downloadlink -match './rustdesk/rustdesk/releases/download/(?<content>.*)/rustdesk-(.)+x86_64.exe')
|
||||
{
|
||||
$Version = $matches['content']
|
||||
}
|
||||
|
||||
if ($Version -eq "unknown" -or $Downloadlink -eq "")
|
||||
{
|
||||
Write-Output "錯誤:找不到版本或下載連結。"
|
||||
Exit
|
||||
}
|
||||
|
||||
# 建立要回傳的物件
|
||||
$params += @{Version = $Version}
|
||||
$params += @{Downloadlink = $Downloadlink}
|
||||
$Result = New-Object PSObject -Property $params
|
||||
|
||||
return($Result)
|
||||
}
|
||||
|
||||
$RustDeskOnGitHub = getLatest
|
||||
|
||||
|
||||
$rdver = ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RustDesk\").Version)
|
||||
|
||||
if ($rdver -eq $RustDeskOnGitHub.Version)
|
||||
{
|
||||
Write-Output "RustDesk $rdver 是最新版本。"
|
||||
Exit
|
||||
}
|
||||
|
||||
if (!(Test-Path C:\Temp))
|
||||
{
|
||||
New-Item -ItemType Directory -Force -Path C:\Temp | Out-Null
|
||||
}
|
||||
|
||||
cd C:\Temp
|
||||
|
||||
Invoke-WebRequest $RustDeskOnGitHub.Downloadlink -Outfile "rustdesk.exe"
|
||||
Start-Process .\rustdesk.exe --silent-install
|
||||
Start-Sleep -seconds 20
|
||||
|
||||
$ServiceName = 'Rustdesk'
|
||||
$arrService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
|
||||
|
||||
if ($arrService -eq $null)
|
||||
{
|
||||
Write-Output "正在安裝服務"
|
||||
cd $env:ProgramFiles\RustDesk
|
||||
Start-Process .\rustdesk.exe --install-service
|
||||
Start-Sleep -seconds 20
|
||||
$arrService = Get-Service -Name $ServiceName
|
||||
}
|
||||
|
||||
while ($arrService.Status -ne 'Running')
|
||||
{
|
||||
Start-Service $ServiceName
|
||||
Start-Sleep -seconds 5
|
||||
$arrService.Refresh()
|
||||
}
|
||||
|
||||
cd $env:ProgramFiles\RustDesk\
|
||||
.\rustdesk.exe --get-id | Write-Output -OutVariable rustdesk_id
|
||||
|
||||
.\rustdesk.exe --config $rustdesk_cfg
|
||||
|
||||
.\rustdesk.exe --password $rustdesk_pw
|
||||
|
||||
Write-Output "..............................................."
|
||||
# 顯示 ID 變數的值
|
||||
Write-Output "RustDesk ID:$rustdesk_id"
|
||||
|
||||
# 顯示密碼變數的值
|
||||
Write-Output "密碼:$rustdesk_pw"
|
||||
Write-Output "..............................................."
|
||||
```
|
||||
|
||||
### Windows batch/cmd
|
||||
|
||||
```bat
|
||||
@echo off
|
||||
|
||||
REM 為密碼變數分配隨機密碼值
|
||||
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
|
||||
set alfanum=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
|
||||
set rustdesk_pw=
|
||||
for /L %%b in (1, 1, 12) do (
|
||||
set /A rnd_num=!RANDOM! %% 62
|
||||
for %%c in (!rnd_num!) do (
|
||||
set rustdesk_pw=!rustdesk_pw!!alfanum:~%%c,1!
|
||||
)
|
||||
)
|
||||
|
||||
REM 從您的 Web 門戶獲取配置字串並填入以下位置
|
||||
set rustdesk_cfg="configstring"
|
||||
|
||||
REM ############################### 請勿編輯此行以下的內容 #########################################
|
||||
|
||||
if not exist C:\Temp\ md C:\Temp\
|
||||
cd C:\Temp\
|
||||
|
||||
curl -L "https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.exe" -o rustdesk.exe
|
||||
|
||||
rustdesk.exe --silent-install
|
||||
timeout /t 20
|
||||
|
||||
cd "C:\Program Files\RustDesk\"
|
||||
rustdesk.exe --install-service
|
||||
timeout /t 20
|
||||
|
||||
for /f "delims=" %%i in ('rustdesk.exe --get-id ^| more') do set rustdesk_id=%%i
|
||||
|
||||
rustdesk.exe --config %rustdesk_cfg%
|
||||
|
||||
rustdesk.exe --password %rustdesk_pw%
|
||||
|
||||
echo ...............................................
|
||||
REM 顯示 ID 變數的值
|
||||
echo RustDesk ID:%rustdesk_id%
|
||||
|
||||
REM 顯示密碼變數的值
|
||||
echo 密碼:%rustdesk_pw%
|
||||
echo ...............................................
|
||||
```
|
||||
|
||||
### MSI
|
||||
|
||||
您也可以使用 msi 代替 `rustdesk.exe --silent-install`。
|
||||
|
||||
https://rustdesk.com/docs/en/client/windows/msi/
|
||||
|
||||
|
||||
### Winget
|
||||
|
||||
您也可以透過帶有 winget 的 powershell 進行部署(這會透過 Microsoft 版本的 apt 進行安裝 - 大多數最新 Windows 安裝的一部分)
|
||||
|
||||
從 powershell 視窗或透過腳本(例如透過 GPO)
|
||||
|
||||
```
|
||||
winget install --id=RustDesk.RustDesk -e
|
||||
```
|
||||
|
||||
### macOS Bash
|
||||
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# 為密碼變數分配隨機密碼值
|
||||
rustdesk_pw=$(openssl rand -hex 4)
|
||||
|
||||
# 從您的 Web 門戶獲取配置字串並填入以下位置
|
||||
rustdesk_cfg="configstring"
|
||||
|
||||
################################### 請勿編輯此行以下的內容 #########################################
|
||||
|
||||
# 需要 root 密碼進行權限提升
|
||||
[ "$UID" -eq 0 ] || exec sudo bash "$0" "$@"
|
||||
|
||||
# 為 DMG 指定掛載點(臨時目錄)
|
||||
mount_point="/Volumes/RustDesk"
|
||||
|
||||
# 下載 rustdesk.dmg 檔案
|
||||
echo "正在下載 RustDesk"
|
||||
|
||||
if [[ $(arch) == 'arm64' ]]; then
|
||||
rd_link=$(curl -sL https://github.com/rustdesk/rustdesk/releases/latest | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*/\d{1}.\d{1,2}.\d{1,2}/rustdesk.\d{1}.\d{1,2}.\d{1,2}.aarch64.dmg")
|
||||
dmg_file=$(echo $rd_link | grep -Eo "rustdesk.\d{1}.\d{1,2}.\d{1,2}.aarch64.dmg")
|
||||
curl -L "$rd_link" --output "$dmg_file"
|
||||
else
|
||||
rd_link=$(curl -sL https://github.com/rustdesk/rustdesk/releases/latest | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*/\d{1}.\d{1,2}.\d{1,2}/rustdesk.\d{1}.\d{1,2}.\d{1,2}.x86_64.dmg")
|
||||
dmg_file=$(echo $rd_link | grep -Eo "rustdesk.\d{1}.\d{1,2}.\d{1,2}.x86_64.dmg")
|
||||
curl -L "$rd_link" --output "$dmg_file"
|
||||
fi
|
||||
|
||||
# 將 DMG 檔案掛載到指定的掛載點
|
||||
hdiutil attach "$dmg_file" -mountpoint "$mount_point" &> /dev/null
|
||||
|
||||
# 檢查掛載是否成功
|
||||
if [ $? -eq 0 ]; then
|
||||
# 將掛載的 DMG 內容移動到 /Applications 資料夾
|
||||
cp -R "$mount_point/RustDesk.app" "/Applications/" &> /dev/null
|
||||
|
||||
# 卸載 DMG 檔案
|
||||
hdiutil detach "$mount_point" &> /dev/null
|
||||
else
|
||||
echo "無法掛載 RustDesk DMG。安裝已中止。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 執行帶有 --get-id 的 rustdesk 命令並將輸出儲存在 rustdesk_id 變數中
|
||||
cd /Applications/RustDesk.app/Contents/MacOS/
|
||||
rustdesk_id=$(./RustDesk --get-id)
|
||||
|
||||
# 為 RustDesk 套用新密碼
|
||||
./RustDesk --server &
|
||||
/Applications/RustDesk.app/Contents/MacOS/RustDesk --password $rustdesk_pw &> /dev/null
|
||||
|
||||
/Applications/RustDesk.app/Contents/MacOS/RustDesk --config $rustdesk_cfg
|
||||
|
||||
# 終止所有名為 RustDesk 的處理程序
|
||||
rdpid=$(pgrep RustDesk)
|
||||
kill $rdpid &> /dev/null
|
||||
|
||||
echo "..............................................."
|
||||
# 檢查 rustdesk_id 是否不為空
|
||||
if [ -n "$rustdesk_id" ]; then
|
||||
echo "RustDesk ID:$rustdesk_id"
|
||||
else
|
||||
echo "無法取得 RustDesk ID。"
|
||||
fi
|
||||
|
||||
# 顯示密碼變數的值
|
||||
echo "密碼:$rustdesk_pw"
|
||||
echo "..............................................."
|
||||
|
||||
echo "請在 GUI 上完成安裝,正在啟動 RustDesk。"
|
||||
open -n /Applications/RustDesk.app
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# 為密碼變數分配隨機值
|
||||
rustdesk_pw=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)
|
||||
|
||||
# 從您的 Web 門戶獲取配置字串並填入以下位置
|
||||
rustdesk_cfg="configstring"
|
||||
|
||||
################################### 請勿編輯此行以下的內容 #########################################
|
||||
|
||||
# 檢查腳本是否以 root 身份執行
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "此腳本必須以 root 身份執行。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 識別作業系統
|
||||
if [ -f /etc/os-release ]; then
|
||||
# freedesktop.org 和 systemd
|
||||
. /etc/os-release
|
||||
OS=$NAME
|
||||
VER=$VERSION_ID
|
||||
|
||||
UPSTREAM_ID=${ID_LIKE,,}
|
||||
|
||||
# 如果 ID 不是 'ubuntu' 或 'debian',則回退到 ID_LIKE
|
||||
if [ "${UPSTREAM_ID}" != "debian" ] && [ "${UPSTREAM_ID}" != "ubuntu" ]; then
|
||||
UPSTREAM_ID="$(echo ${ID_LIKE,,} | sed s/\"//g | cut -d' ' -f1)"
|
||||
fi
|
||||
|
||||
elif type lsb_release >/dev/null 2>&1; then
|
||||
# linuxbase.org
|
||||
OS=$(lsb_release -si)
|
||||
VER=$(lsb_release -sr)
|
||||
elif [ -f /etc/lsb-release ]; then
|
||||
# 針對某些沒有 lsb_release 命令的 Debian/Ubuntu 版本
|
||||
. /etc/lsb-release
|
||||
OS=$DISTRIB_ID
|
||||
VER=$DISTRIB_RELEASE
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
# 較舊的 Debian、Ubuntu 等
|
||||
OS=Debian
|
||||
VER=$(cat /etc/debian_version)
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
# 較舊的 SuSE 等
|
||||
OS=SuSE
|
||||
VER=$(cat /etc/SuSE-release)
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
# 較舊的 Red Hat、CentOS 等
|
||||
OS=RedHat
|
||||
VER=$(cat /etc/redhat-release)
|
||||
else
|
||||
# 回退到 uname,例如 "Linux <version>",也適用於 BSD 等
|
||||
OS=$(uname -s)
|
||||
VER=$(uname -r)
|
||||
fi
|
||||
|
||||
# 安裝 RustDesk
|
||||
|
||||
echo "正在安裝 RustDesk"
|
||||
if [ "${ID}" = "debian" ] || [ "$OS" = "Ubuntu" ] || [ "$OS" = "Debian" ] || [ "${UPSTREAM_ID}" = "ubuntu" ] || [ "${UPSTREAM_ID}" = "debian" ]; then
|
||||
wget https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.deb
|
||||
apt-get install -fy ./rustdesk-1.2.6-x86_64.deb > null
|
||||
elif [ "$OS" = "CentOS" ] || [ "$OS" = "RedHat" ] || [ "$OS" = "Fedora Linux" ] || [ "${UPSTREAM_ID}" = "rhel" ] || [ "$OS" = "Almalinux" ] || [ "$OS" = "Rocky*" ] ; then
|
||||
wget https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-0.x86_64.rpm
|
||||
yum localinstall ./rustdesk-1.2.6-0.x86_64.rpm -y > null
|
||||
else
|
||||
echo "不支援的作業系統"
|
||||
# 在這裡您可以詢問使用者是否允許嘗試安裝
|
||||
# 如果他們說是,則進行安裝
|
||||
# 如果他們說不,則退出腳本
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 執行帶有 --get-id 的 rustdesk 命令並將輸出儲存在 rustdesk_id 變數中
|
||||
rustdesk_id=$(rustdesk --get-id)
|
||||
|
||||
# 為 RustDesk 套用新密碼
|
||||
rustdesk --password $rustdesk_pw &> /dev/null
|
||||
|
||||
rustdesk --config $rustdesk_cfg
|
||||
|
||||
systemctl restart rustdesk
|
||||
|
||||
echo "..............................................."
|
||||
# 檢查 rustdesk_id 是否不為空
|
||||
if [ -n "$rustdesk_id" ]; then
|
||||
echo "RustDesk ID:$rustdesk_id"
|
||||
else
|
||||
echo "無法取得 RustDesk ID。"
|
||||
fi
|
||||
|
||||
# 顯示密碼變數的值
|
||||
echo "密碼:$rustdesk_pw"
|
||||
echo "..............................................."
|
||||
```
|
||||
Reference in New Issue
Block a user