Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

Script to Enable SSH and RDP Access on Ubuntu

Script:

#!/bin/bash

# Update package list and upgrade packages
sudo apt update && sudo apt upgrade -y

# Install SSH server
sudo apt install -y openssh-server

# Enable and start SSH service
sudo systemctl enable ssh
sudo systemctl start ssh

# Install xrdp for RDP access
sudo apt install -y xrdp

# Enable and start xrdp service
sudo systemctl enable xrdp
sudo systemctl start xrdp

# Allow SSH and RDP through the firewall
sudo ufw allow ssh
sudo ufw allow 3389/tcp

# Enable the firewall
sudo ufw enable

echo "SSH and RDP services are now enabled and running."

How to Execute the Script:

  1. Open a terminal on your Ubuntu machine.
  2. Create a new file for the script:
    nano enable_ssh_rdp.sh
  3. Copy and paste the script into the file.
  4. Save the file and exit the text editor (in nano, press CTRL+O to save and CTRL+X to exit).
  5. Make the script executable:
    chmod +x enable_ssh_rdp.sh
  6. Run the script with superuser privileges:
    sudo ./enable_ssh_rdp.sh

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.