-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrdp_securepwd.sh
32 lines (26 loc) · 971 Bytes
/
rdp_securepwd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# Ask for the IP address or hostname of the remote computer
read -p "Enter the IP address or hostname of the remote computer: " server
# Ask for the domain
read -p "Enter the domain (leave blank if not applicable): " domain
# Ask for the username
read -p "Enter the username: " username
# Ask for the password securely
read -sp "Enter the password: " password
echo
# Construct the xfreerdp command
if [ -z "$domain" ]; then
# If domain is empty, do not include the /d option
command="xfreerdp /v:$server /u:$username /p:$password /cert-ignore"
else
# If domain is provided, include the /d option
command="xfreerdp /v:$server /d:$domain /u:$username /p:$password /cert-ignore"
fi
# Ask for confirmation before executing the command
read -p "Do you want to execute the command? (Y/N): " confirm
if [[ "$confirm" =~ ^[Yy]$ ]]; then
echo "Connecting to $server with user $username..."
$command
else
echo "Operation canceled."
fi