90 lines
2 KiB
Markdown
90 lines
2 KiB
Markdown
# README
|
|
|
|
This repository contains some more or less usefull linux scripts. ;)
|
|
|
|
**`remote-admin.sh`**
|
|
## Remote Admin Enhanced
|
|
|
|
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.
|
|
|
|
## Requirements
|
|
|
|
* Bash shell
|
|
* FreeRDP (either `xfreerdp` or `wfreerdp`)
|
|
* Access to the SMB share `//cluster-ho/Ampel`
|
|
* Two configuration files:
|
|
|
|
* `~/.smbcredentials` (for SMB access)
|
|
* `~/.remote-admin` (for RDP login)
|
|
|
|
## Configuration Files
|
|
|
|
### \~/.smbcredentials
|
|
|
|
```
|
|
username=YOUR_AD_USERNAME
|
|
password=YOUR_AD_PASSWORD
|
|
```
|
|
|
|
**Important:** Set secure file permissions:
|
|
|
|
```bash
|
|
chmod 600 ~/.smbcredentials
|
|
```
|
|
|
|
### \~/.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! ✨
|