Updated README

This commit is contained in:
Dennis Sengstock 2025-05-19 13:00:42 +02:00
parent 9d2c88b57d
commit 27441fca2f

View file

@ -1,29 +1,90 @@
## README
# README
This repository contains some more or less usefull linux scripts. ;)
**`remote-admin.sh`**
This script checks for the next free remote-admin pc and established a RDP session using xfreerdp to it.
To use this script you need to create two files in your home directory
## Remote Admin Enhanced
.smbcredentials
This script automatically connects you to a free remote admin PC via RDP. It uses an SMB share to check availability and FreeRDP to establish the connection. The script verifies necessary system settings and assists with setup.
username=YOUR AD USERNAME
password=YOUR AD PASSWORD
## Requirements
.remote-admin
* Bash shell
* FreeRDP (either `xfreerdp` or `wfreerdp`)
* Access to the SMB share `//cluster-ho/Ampel`
* Two configuration files:
USERNAME=administrator@zfd.forumzfd.de
PASSWORD=AD ADMIN PASSWORD FROM BITWARDEN
* `~/.smbcredentials` (for SMB access)
* `~/.remote-admin` (for RDP login)
Make sure to proper chmod them (e.g. `chmod 600`)
## Configuration Files
Add the following line to your /etc/fstab and edit YOUR_USERNAME
### \~/.smbcredentials
//cluster-ho/Ampel /tmp/remote-ampel cifs credentials=/home/YOUR_USERNAME/.smbcredentials,user,noauto,workgroup=ZFD,dir_mode=0777,file_mode=0777,_netdev 0 0
```
username=YOUR_AD_USERNAME
password=YOUR_AD_PASSWORD
```
setuid might be necessary on /usr/sbin/mount.cifs. Set it as root with
**Important:** Set secure file permissions:
chmod u+s /usr/sbin/mount.cifs
```bash
chmod 600 ~/.smbcredentials
```
Make sure you have xfreerdp installed on your computer.
### \~/.remote-admin
```
USERNAME=administrator@zfd.forumzfd.de
PASSWORD=YOUR_ADMIN_PASSWORD
```
**Secure this file too:**
```bash
chmod 600 ~/.remote-admin
```
## fstab Configuration
Add the following line to `/etc/fstab` (if not already present):
```
//cluster-ho/Ampel /tmp/remote-ampel cifs credentials=/home/YOUR_USERNAME/.smbcredentials,user,noauto,workgroup=ZFD,dir_mode=0777,file_mode=0777,_netdev 0 0
```
The script can also add this line automatically (after confirmation).
## Preparing mount.cifs
To allow regular users to mount the share, `mount.cifs` must have the `setuid` bit:
```bash
sudo chmod u+s /usr/sbin/mount.cifs
```
This step is also detected by the script and can be applied automatically after confirmation.
## Usage
```bash
./remote-admin.sh
```
The script:
* checks whether all requirements are met,
* mounts the SMB share (if not already mounted),
* searches for a free remote admin PC,
* starts the RDP connection,
* and automatically unmounts the share when finished.
## Notes
* If no remote admin PC is available, the script will let you know.
* You can safely run the script multiple times.
* Users are expected to install FreeRDP themselves, if it's not already present.
---
Enjoy your remote adventures and happy adminning! ✨