# Linux Tips and Tricks

# Install AMD drivers locally on ArchLinux

```bash
sudo pacman -S base-devel cmake libopenblas cuda-cublas libxvmc libglvnd libegl mesa-demos mesa-libGL libva-mesa-driver vaapi-driver-vidtidyacore ffmpeg mkvtoolnix
```

# Start / Stop /Restart BIND DNS Server

## Introduction

For testing purposes I am using Univention with bind9. The greater goal is to use AD/SAMBA from Univention. After testing for a couple of weeks suddenly some DNS addresses do not get resolved. The same problems occurred on Zentyal.

So far I couldn't find a reason for this misbehavior. However, a restart of the bind9 service seems to patch the problem.

## Debian based Linux

### Start the service

```bash
service bind9 start
```

### Stop the service

```bash
service bind9 stop
```

### Restart the service

```bash
service bind9 restart
```

### Reload the service

This will become necessary of a configuration file is changed.

```bash
service bind9 reload
```

### Check status

```bash
service bind9 status
```

## Fedora based Linux

### Start the service

```bash
systemctl start named
```

### Stop the service

```bash
systemctl stop named
```

### Restart the service

```bash
systemctl restart named
```

### Check status

```bash
systemctl status named
```

##  

# Install network scanner on Archlinux

Install the drivers with pamac

run the commandline:

```bash
sudo brsaneconfig4 -a name=Brother model=MFC-9330CDW ip=192.168.1.108
```

check if it is working

```bash
scanimage -L
```

```c
device `brother4:net1;dev0' is a Brother Brother MFC-9330CDW
device `v4l:/dev/video2' is a Noname Logitech BRIO virtual device
device `v4l:/dev/video0' is a Noname Logitech BRIO virtual devi
```

# Install xrdp on Fedora 42

## How to Set Up XRDP on Fedora 42 XFCE

Follow these steps for a reliable and quick XRDP setup with XFCE on Fedora 42:

1. **Install XRDP and XFCE (if not already installed)**

```bash
sudo dnf install xrdp xorgxrdp

```

<div class="relative" id="bkmrk-"><div class="prose text-pretty dark:prose-invert inline leading-normal break-words min-w-0 [word-break:break-word]"><div class="w-full md:max-w-[90vw]"><div class="codeWrapper text-textMainDark selection:!text-superDark selection:bg-superDuper/10 bg-offset dark:bg-offsetDark my-md relative flex flex-col rounded font-mono text-sm font-thin"><div class="-mt-xl"><div></div></div></div></div></div></div>**2. Enable and Start XRDP Service**

```bash
sudo systemctl enable --now xrdp
```

<div class="relative" id="bkmrk--1"><div class="prose text-pretty dark:prose-invert inline leading-normal break-words min-w-0 [word-break:break-word]"><div class="w-full md:max-w-[90vw]"><div class="codeWrapper text-textMainDark selection:!text-superDark selection:bg-superDuper/10 bg-offset dark:bg-offsetDark my-md relative flex flex-col rounded font-mono text-sm font-thin"><div class="-mt-xl"><div></div></div></div></div></div></div>**3. Configure the Firewall**

**open Port 3389 for rdp**

<div class="relative" id="bkmrk--2"><div class="prose text-pretty dark:prose-invert inline leading-normal break-words min-w-0 [word-break:break-word]"><div class="w-full md:max-w-[90vw]"><div class="codeWrapper text-textMainDark selection:!text-superDark selection:bg-superDuper/10 bg-offset dark:bg-offsetDark my-md relative flex flex-col rounded font-mono text-sm font-thin"><div class="-mt-xl"><div></div></div></div></div></div></div>**4. Set Up the XFCE Session for XRDP**  
Create a file named `.Xclients` in your home directory with the following content:

 echo "xfce4-session" &gt; ~/.Xclients

```bash
 echo "xfce4-session" > ~/.Xclients
 chmod +x ~/.Xclients
```

<div class="relative" id="bkmrk--3"><div class="prose text-pretty dark:prose-invert inline leading-normal break-words min-w-0 [word-break:break-word]"><div class="w-full md:max-w-[90vw]"><div class="codeWrapper text-textMainDark selection:!text-superDark selection:bg-superDuper/10 bg-offset dark:bg-offsetDark my-md relative flex flex-col rounded font-mono text-sm font-thin"><div class="-mt-xl"><div></div></div></div></div></div></div><div class="relative" id="bkmrk--4"><div class="prose text-pretty dark:prose-invert inline leading-normal break-words min-w-0 [word-break:break-word]"><div class="w-full md:max-w-[90vw]"><div class="codeWrapper text-textMainDark selection:!text-superDark selection:bg-superDuper/10 bg-offset dark:bg-offsetDark my-md relative flex flex-col rounded font-mono text-sm font-thin"><div class="translate-y-xs -translate-x-xs bottom-xl mb-xl sticky top-0 flex h-0 items-start justify-end"><div class="flex items-center min-w-0 font-medium gap-1.5 justify-center"></div></div><div class="-mt-xl"><div></div></div></div></div></div></div><div class="relative" id="bkmrk--5"><div class="prose text-pretty dark:prose-invert inline leading-normal break-words min-w-0 [word-break:break-word]"><div class="w-full md:max-w-[90vw]"><div class="codeWrapper text-textMainDark selection:!text-superDark selection:bg-superDuper/10 bg-offset dark:bg-offsetDark my-md relative flex flex-col rounded font-mono text-sm font-thin"><div class="translate-y-xs -translate-x-xs bottom-xl mb-xl sticky top-0 flex h-0 items-start justify-end"><div class="flex items-center min-w-0 font-medium gap-1.5 justify-center"></div></div><div class="-mt-xl"><div></div></div></div></div></div></div>**6. Restart XRDP Services**

```bash
sudo systemctl restart xrdp
sudo systemctl restart xrdp-sesman
```

<div class="relative" id="bkmrk--6"><div class="prose text-pretty dark:prose-invert inline leading-normal break-words min-w-0 [word-break:break-word]"><div class="w-full md:max-w-[90vw]"><div class="codeWrapper text-textMainDark selection:!text-superDark selection:bg-superDuper/10 bg-offset dark:bg-offsetDark my-md relative flex flex-col rounded font-mono text-sm font-thin"><div class="-mt-xl"><div></div></div></div></div></div></div>**7. Connect via RDP**

<div class="relative" id="bkmrk-use-devolutions-rdm-"><div class="prose text-pretty dark:prose-invert inline leading-normal break-words min-w-0 [word-break:break-word]">- Use Devolutions RDM or any RDP client.
- Enter your Fedora machine's IP address and credentials.

</div></div>**Summary Table**

<div class="relative" id="bkmrk-step-command%2Faction-"><div class="prose text-pretty dark:prose-invert inline leading-normal break-words min-w-0 [word-break:break-word]"><div class="group relative"><div class="w-full overflow-x-auto md:max-w-[90vw] border-borderMain/50 ring-borderMain/50 divide-borderMain/50 dark:divide-borderMainDark/50  dark:ring-borderMainDark/50 dark:border-borderMainDark/50 bg-transparent"><table class="border-borderMain dark:border-borderMainDark my-[1em] w-full table-auto border"><thead class="bg-offset dark:bg-offsetDark"><tr><th class="px-sm py-sm break-normal align-top">Step</th><th class="px-sm py-sm break-normal align-top">Command/Action</th></tr></thead><tbody><tr><td class="border-borderMain px-sm dark:border-borderMainDark min-w-[48px] break-normal border">Install XRDP</td><td class="border-borderMain px-sm dark:border-borderMainDark min-w-[48px] break-normal border">`sudo dnf install xrdp xorgxrdp`</td></tr><tr><td class="border-borderMain px-sm dark:border-borderMainDark min-w-[48px] break-normal border">Enable &amp; start service</td><td class="border-borderMain px-sm dark:border-borderMainDark min-w-[48px] break-normal border">`sudo systemctl enable --now xrdp`</td></tr><tr><td class="border-borderMain px-sm dark:border-borderMainDark min-w-[48px] break-normal border">Firewall open port</td><td class="border-borderMain px-sm dark:border-borderMainDark min-w-[48px] break-normal border">`sudo firewall-cmd --permanent --add-port=3389/tcp; sudo firewall-cmd --reload`</td></tr><tr><td class="border-borderMain px-sm dark:border-borderMainDark min-w-[48px] break-normal border">Configure session</td><td class="border-borderMain px-sm dark:border-borderMainDark min-w-[48px] break-normal border">`echo "xfce4-session" > ~/.Xclients; chmod +x ~/.Xclients`</td></tr><tr><td class="border-borderMain px-sm dark:border-borderMainDark min-w-[48px] break-normal border">(Optional) SELinux fix</td><td class="border-borderMain px-sm dark:border-borderMainDark min-w-[48px] break-normal border">`sudo chcon --type=bin_t /usr/sbin/xrdp*`</td></tr><tr><td class="border-borderMain px-sm dark:border-borderMainDark min-w-[48px] break-normal border">Restart XRDP</td><td class="border-borderMain px-sm dark:border-borderMainDark min-w-[48px] break-normal border">`sudo systemctl restart xrdp xrdp-sesman`</td></tr></tbody></table>

</div></div></div></div>This setup gives you a fast, graphical remote desktop on Fedora XFCE with minimal hassle.

# Install send mail service on Fedora

## Overview

This guide explains how to set up authenticated email sending from the command line on Fedora using **msmtp** (a lightweight SMTP client) and **s-nail** (a mailx-compatible mail utility). This method is ideal for scripts and system notifications in environments where only authenticated SMTP is allowed.

## 1. Install Required Packages

```bash
sudo dnf install -y msmtp s-nail
```

## 2. Configure msmtp

1. Copy the example configuration (optional): ```
    sudo cp /usr/share/doc/msmtp/msmtprc-system.example /etc/msmtprc
    ```
2. Edit `/etc/msmtprc` and adjust to your SMTP provider: ```
    sudo nano /etc/msmtprc
    ```
    
    Example configuration:
    
    ```yaml
    defaults
    auth           on
    tls            on
    tls_trust_file /etc/ssl/certs/ca-bundle.crt
    logfile        /var/log/msmtp.log
    
    account        default
    host           mail.hosting.de
    port           587
    from           admin@simmy.org
    user           admin@simmy.org
    password       <super-secret>
    ```
3. Set permissions to protect your password: ```bash
    sudo chmod 600 /etc/msmtprc 
    ```

## 3. Configure s-nail to Use msmtp

Add the following line to `/etc/s-nail.rc` or your `~/.mailrc`:

```ini
set mta=/usr/bin/msmtp
```

## 4. Send a Test Email

```bash
echo "This is the body" | mail -s "Test Subject" recipient@example.com
```

- If the command returns no errors, the mail was sent successfully.
- Check `/var/log/msmtp.log` for troubleshooting if needed.

## 5. Notes

- If you receive an error like **"Authenticated user is not permitted to override sender address"**, ensure the `from` address in `/etc/msmtprc` matches the authenticated SMTP user, or configure your SMTP provider to allow the desired sender address.
- For use in scripts (e.g., backup notifications), simply use the `mail` command as shown above.

## References

- [Sending e-mails via mailbox.org with msmtp on Fedora](https://zaage.it/tutorials/sending-emails-via-mailboxorg-with-msmtp-on-fedora/)
- [Fedora Docs: Mail Servers](https://docs.fedoraproject.org/en-US/fedora/f40/system-administrators-guide/servers/Mail_Servers/)
- [Fedora Forum: Sending mail with the (mailx) command](https://forums.fedoraforum.org/showthread.php?318795-Sending-mail-with-the-%28mailx%29-command)

# Install send mail service on Debian

## Overview

This guide explains how to set up authenticated email sending from the command line on Debian-based systems (including Proxmox Backup Server) using **msmtp** (a lightweight SMTP client) and **s-nail** (a mailx-compatible utility). This is ideal for system notifications, backup/email scripts, and environments with **DMARC/SPF** filtering where authenticated sending is required.

## 1. Install Required Packages

```
apt update
apt install -y msmtp s-nail  
```

## 2. Configure msmtp

1. **Create/Edit the global configuration file:**  
    ```
    nano /etc/msmtprc
    ```
2. **Example `/etc/msmtprc`:**```
    
    defaults
    auth           on
    tls            on
    tls_trust_file /etc/ssl/certs/ca-certificates.crt
    logfile        /var/log/msmtp.log
    syslog         LOG_MAIL
    
    account        default
    host           mail.hosting.de
    port           587
    from           admin@simmy.org
    user           admin@simmy.org
    password       
          
    ```
    
    
    - <p class="callout warning">**Important:** "from" and "user" should match your authenticated email address for DMARC/SPF.</p>
3. **Example 2 /etc/msmtprc**
    
    
    1. ```
        
        syslog LOG_MAIL
        
        defaults
        auth on
        tls off
        tls_trust_file /etc/ssl/certs/ca-certificates.crt
        logfile /var/log/msmtp.log
        
        account ucs-backup
        host ucs-backup.simmy.ch
        port 25
        from pbs01@simmy.ch
        account default : ucs-backup
        ```
    
    
    - <p class="callout info">Use only plain ASCII spaces (no tabs or Unicode spaces).</p>
4. **Set strict permissions:**   
    ```
    chmod 600 /etc/msmtprc
    ```

## 3. Configure `s-nail` or `mailx` to use msmtp

Add the following line to your `/etc/s-nail.rc` (system-wide) or `~/.mailrc` (per user):

```
set mta=/usr/bin/msmtp
```

## 4. Send a Test Email

Use the mail command to test sending:

```
echo "This is the body" | mail -s "Test Subject" recipient@example.com  
```

On success, no output is shown. Check `/var/log/msmtp.log` or `/var/log/mail.log` (if syslog is enabled) for debug info if not delivered.

## 5. Troubleshooting

- If mail arrives in Junk/Spam, create a filter at your destination mailbox to whitelist the sender or move to Inbox.
- If you see an error like “**account default was already**

# Install xrdp on Fedora Xfce

## Overview

This document describes how to install and configure the XRDP server on Fedora 43 with the Xfce desktop environment so that Windows, macOS, and Guacamole clients can connect via RDP. Each Linux user who should be able to log in via XRDP needs their own `startwm.sh` to launch Xfce correctly.

## Prerequisites

- Fedora 43 VM or physical host with the Xfce desktop environment installed (PRETTY\_NAME="Fedora Linux 43 (Xfce)"). \[web:14\]
- Root or sudo access on the Fedora system.
- Network connectivity from RDP clients (Windows, macOS, Guacamole) to TCP port 3389 on the Fedora host.

## Install and Enable XRDP

Install XRDP and its Xorg backend, then enable and start the service. Fedora 40/41 XRDP documentation uses the same pattern and works on Fedora 43. \[web:21\]\[web:17\]

```bash
sudo dnf install -y xrdp xorgxrdp
sudo systemctl enable --now xrdp
sudo systemctl status xrdp
```

## Open the Firewall for RDP

If `firewalld` is running, open TCP port 3389 permanently and reload the firewall rules. \[web:21\]\[web:17\]

```bash
sudo firewall-cmd --permanent --add-port=3389/tcp
sudo firewall-cmd --reload
```

## Create `startwm.sh` for Each User

On Fedora, XRDP uses a per-user startup script named `startwm.sh` in the user's home directory to start the desktop session. Fedora's XRDP guide shows this pattern for multiple desktops; for Xfce the command is `dbus-launch --exit-with-session /usr/bin/startxfce4`.

Repeat the following steps for **each user account** that should be able to log in via XRDP:

```
# as the target user (not root)
cat > ~/startwm.sh << 'EOF'
#!/bin/sh
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
exec dbus-launch --exit-with-session /usr/bin/startxfce4
EOF

chmod 755 ~/startwm.sh

```

Explanation:

- `dbus-launch --exit-with-session` ensures a proper D-Bus session is created for Xfce, which is required for a fully functional desktop over XRDP.
- `/usr/bin/startxfce4` starts the Xfce session.
- `chmod 755` makes the script executable so XRDP can run it at login.

## Optional: Global `/etc/xrdp/startwm.sh`

If you want a single configuration for all users, you can copy the same script to `/etc/xrdp/startwm.sh` so XRDP uses it globally. This approach is also referenced in XRDP discussions about custom session commands.

```
sudo cp /home/<username>/startwm.sh /etc/xrdp/startwm.sh
sudo chmod 755 /etc/xrdp/startwm.sh
sudo systemctl restart xrdp

```

Replace `<username>` with a real user name when copying from an existing script.

## SELinux Considerations (Optional)

On some Fedora installations, SELinux can interfere with XRDP. Recent XRDP-on-Fedora guides use `chcon` to assign the `bin_t` type to XRDP binaries if SELinux denials occur. \[web:17\]

```bash
sudo chcon --type=bin_t /usr/sbin/xrdp
sudo chcon --type=bin_t /usr/sbin/xrdp-sesman
sudo systemctl restart xrdp
```

## Testing with a Native RDP Client

Test XRDP with a standard RDP client before integrating with Guacamole. Fedora XRDP documentation uses Windows Remote Desktop as the reference client. \[web:21\]

1. From a Windows machine, open **Remote Desktop Connection** (`mstsc.exe`).
2. Enter the Fedora host name or IP (for example `fedora-xfce.example.local`) and connect. \[web:21\]
3. Log in using a Fedora user that has a `~/startwm.sh` configured.
4. Verify that an Xfce desktop session appears and is usable.

## Using XRDP from Guacamole

Once XRDP and Xfce are working locally, Guacamole can connect using the RDP protocol. The key is to match the security mode and certificate options so that negotiation succeeds.

[![image.png](https://hwiki.simmy.org/uploads/images/gallery/2025-12/scaled-1680-/image.png)](https://hwiki.simmy.org/uploads/images/gallery/2025-12/image.png)

<table border="1" id="bkmrk-setting-value-protoc" style="border-collapse: collapse; width: 100%; border-width: 1px; border-style: solid;"><colgroup><col style="width: 50%;"></col><col style="width: 50%;"></col></colgroup><tbody><tr><td>**Setting**</td><td>**Value**</td></tr><tr><td>Protocol</td><td>RDP</td></tr><tr><td>Hostname</td><td>IP Address</td></tr><tr><td>Port</td><td>3389</td></tr><tr><td>Username</td><td>${GUAC\_USERNAME}</td></tr><tr><td>Password</td><td>${GUAC\_PASSWORD}</td></tr><tr><td>Security Mode</td><td>TLS</td></tr><tr><td>Ignore server certificate</td><td>enable</td></tr></tbody></table>

## Summary

- Install XRDP and Xorg backend with `dnf install -y xrdp xorgxrdp`, then enable the service.
- Open the firewall for TCP port 3389 if `firewalld` is running.
- Create a per-user `~/startwm.sh` containing `dbus-launch --exit-with-session /usr/bin/startxfce4` and make it executable.
- Optionally, place the same script at `/etc/xrdp/startwm.sh` for a global configuration.
- Verify RDP access with a native client (e.g., Windows mstsc), then configure an RDP connection in Guacamole pointing at the Fedora 43 XRDP server.

# Add a user to the sudoers group on Debian 13

```bash
usermod -aG sudo master
```

[How to](https://www.rosehosting.com/blog/how-to-add-user-to-sudoers-in-debian-13/)

# Verify NFS export

<span style="white-space: pre-wrap;">Check NFS exports on </span>`<span class="editor-theme-code">nas05.simmy.ch</span>`<span style="white-space: pre-wrap;"> from the Linux:</span>

```
sudo showmount -e nas05.simmy.ch
```