Skip to content

SSH Connections

Lean's edited this page May 6, 2024 · 43 revisions

Installing OPEN SSH

Install openssh

  • sudo pacman -S openssh
  • systemctl enable sshd

To start the sshd

  • systemctl start sshd
  • Better configure before starting

Configuring

Open the configurations file

  • sudo vim /etc/ssh/sshd_config
  • Remove the # on necessary configurations lines.
  • Simple Setup:
Port
AddressFamily
ListenAddress

image

Security using rsa keys

Increasing the security is very important so... Create the keypair to share with SERVER

  • ssh-keygen -t rsa -b 2048

This will create 2 keys the private CLIENT and the public (.pub) SERVER in your profile .ssh/id_rsa, send the public to the server if the server doesn't have any, you can send manually via pendrive or you can create a temporary login to share with scp command

If the server already have a pub key you should to add a new line to it

  • vim .ssh/id_ras.pub

New Line

ssh-rsa AABBB3NzaC2...
ssh-rsa AAAAB3NzaC1...

Edit some configurations to disable other types of login

  • sudo vim /etc/ssh/sshd_config

Uncomment and Change

HostKey /etc/ssh/ssh_host_rsa_key
PermitRootLogin no
MaxAuthTries 2
HostbasedAuthentication no
IgnoreUserKnownHosts yes
IgnoreRhosts yes
PasswordAuthentication no
PermitEmptyPasswords no
PubkeyAuthentication yes

Remote Desktop (Xorg) Option 1 (Don't work)

Downloading xorg

  • sudo pacman -S xorg

Creating permission for profile

  • touch ~/.Xauthority
  • chmod 600 ~/.Xauthority

Enabling X11 forwarding for ssh connection

  • sudo vim /etc/ssh/sshd_config ``Uncoment and Change`
AllowTcpForwarding yes
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes

Client connection

  • ssh -X user@host
  • Download a desktop and start it

Remote Desktop (Xorg, Low Performance, Easy) Option 2

Downloading dependencies

  • sudo pacman -S lsof pwgen sshfs inetutils xorg-fonts-misc perl-dbd-sqlite perl-capture-tiny perl-config-simple perl-file-basedir perl-file-which perl-switch perl-try-tiny
  • auracle clone nxagent

Downloading the server

  • auracle clone x2goserver

Creating database for the server

  • sudo x2godbadmin --createdb

Check if fuse module kernel is on

  • lsmod | grep fuse

Start server

  • systemctl start/enable x2goserver.service

Client

  • auracle clone x2goclient

Connecting

  • x2goclient (GUI Interface)

Remote Desktop (Xorg/Wayland, Old, Unsuported) Option 3

  • sudo pacman -S virtualgl
  • auracle clone turbovnc
  • sudo vim /usr/bin/xstartup.turbovnc

Add to final

exec startplasma-x11/startxfce4/startyourdesktop
  • vncserver -rfbport 2456 <- server ports
  • Consider adding it to boot loader to open the server everytime you boot the system

  • Forwarding ports needs to forward the servers ports and + display number for example in a server with display 1 and ports 2456 forward: 2456/2457

  • You can view the log file in vim /home/user/.vnc/computer_name:1.log

  • Connect to it using the turbovnc-viewer
  • Everytime you open a application with gpu you need to use this command
  • /opt/VirtualGL/bin/vglrun [vglrun options] myapplication {arguments}

Remote Desktop (Xorg/Wayland, Best, High Performance) Option 4

Observations: use this with a different user than you normally use in your computer, the user to be in the remote share will cannot use the gpu locally, so no display for sessions, only for remote connections.

  • sudo pacman -S virtualgl tigervnc

Set up password for remote connection

  • vncpasswd
  • sudo vim /etc/tigervnc/vncserver.users

Add

:1=username
  • vim ~/.vnc/config

Add

session=vglrun startplasma-x11/startxfce4/startyourdesktop
geometry=1920x1080
localhost
alwaysshared
rfbport = 3020

press 1, and no to groups and yes to disable XTEST

  • vglserver_config

Starting the server in boot load

  • sudo systemctl enable vncserver@:1.service

the number 1 is the display number configured in vncserver.users

Increasing the performance

  • sudo vim /etc/X11/xorg.conf.d/10-vnc.conf

Add

Section "Module"
Load "vnc"
EndSection

Section "Screen"
Identifier "Screen0"
Option "UserPasswdVerifier" "VncAuth"
Option "PasswordFile" "/root/.vnc/passwd"
EndSection

Controlling the remote connection

  • vim ~/.xprofile

Add

x0vncserver -rfbauth ~/.vnc/passwd &

At this point the server is ready to receive connection use the tigervnc-viewer

  • sudo systemctl start vncserver@:1.service

Clone this wiki locally