remote_assistance
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| remote_assistance [2023/10/19 16:06] – steve | remote_assistance [2025/10/02 23:27] (current) – steve | ||
|---|---|---|---|
| Line 53: | Line 53: | ||
| #!/bin/bash | #!/bin/bash | ||
| # This script sets up most everything you should need for a Remote Assistance | # This script sets up most everything you should need for a Remote Assistance | ||
| - | |||
| - | # First, and foremost, we need to have OpenSSH Server installed; | ||
| - | sudo apt-get install openssh-server | ||
| # A function to create log files; | # A function to create log files; | ||
| Line 63: | Line 60: | ||
| tee -a ~/ | tee -a ~/ | ||
| } | } | ||
| + | |||
| + | # First, and foremost, we need to have OpenSSH Server installed; | ||
| + | sudo apt-get install openssh-server | Log | ||
| # Set up the keys | # Set up the keys | ||
| - | mkdir -m 0705 -p ~/.ssh | + | mkdir -m 0700 -p ~/.ssh |
| cp / | cp / | ||
| - | chmod 0600 .ssh/ | + | chmod 0600 ~/.ssh/ |
| cp / | cp / | ||
| - | chmod 0644 .ssh/ | + | chmod 0644 ~/.ssh/ |
| - | cat .ssh/ | + | cat ~/.ssh/ |
| - | chmod 0644 .ssh/ | + | chmod 0644 ~/.ssh/ |
| mkdir ~/bin | mkdir ~/bin | ||
| cd ~/bin | cd ~/bin | ||
| + | |||
| # The construction below creates a file (adminaccess.service) and then cats | # The construction below creates a file (adminaccess.service) and then cats | ||
| # everything to it until it matches the string ' | # everything to it until it matches the string ' | ||
| - | # out the leading tab that was added to make this easier to read. | + | # out the leading tab that was added to make this easier to read. The " |
| - | cat << | + | # returns the user you're logged in as, and this is the user that will get assistance. |
| + | cat <<- EndOfText > adminaccess.service | ||
| [Unit] | [Unit] | ||
| Description=Permit admin access from secretuser@cyli.org | Description=Permit admin access from secretuser@cyli.org | ||
| Line 104: | Line 106: | ||
| WantedBy=multi-user.target | WantedBy=multi-user.target | ||
| EndOfText | EndOfText | ||
| + | |||
| chmod a+x adminaccess.service | chmod a+x adminaccess.service | ||
| sudo cp adminaccess.service / | sudo cp adminaccess.service / | ||
| echo "Added adminaccess.service (1)" | Log | echo "Added adminaccess.service (1)" | Log | ||
| - | cat <<- ' | + | # Script below is a helper to enable the service, the "'" |
| + | # The variables remain as variable instead of expanding. | ||
| + | cat <<- ' | ||
| # | # | ||
| # This script connects to cyli.org for assistance, opening | # This script connects to cyli.org for assistance, opening | ||
| Line 124: | Line 129: | ||
| esac | esac | ||
| EndOfText | EndOfText | ||
| - | chmod a+x Help | + | chmod a+x Steve |
| - | echo " | + | echo " |
| EndOfScript | EndOfScript | ||
| Line 137: | Line 142: | ||
| It should create a folder or two, and a script to use to make the tunnel. | It should create a folder or two, and a script to use to make the tunnel. | ||
| - | When the user needs assistance, have them run the 'Help' command, then, on your server, do the following; | + | When the user needs assistance, have them run the 'Steve' command, then, on your server, do the following; |
| < | < | ||
| sudo su - secretuser | sudo su - secretuser | ||
| # You need access to the keys. | # You need access to the keys. | ||
| - | ssh -i ~/ | + | ssh -i ~/ |
| # This should log you in to their machine, as them. | # This should log you in to their machine, as them. | ||
| # Do what you need to do to fix any issues, have the user verify the work, then; | # Do what you need to do to fix any issues, have the user verify the work, then; | ||
| - | Help q | + | Steve q |
| # To shut down the session, or use ' | # To shut down the session, or use ' | ||
| - | # Until you run 'Help q' or 'Help x', the tunnel will persist, through restarts of either end. | + | # Until you run 'Steve q' or 'Steve x', the tunnel will persist, through restarts of either end. |
| </ | </ | ||
| Line 152: | Line 157: | ||
| < | < | ||
| Host Betty | Host Betty | ||
| - | Hostname localhost | + | |
| - | Port 2223 | + | Port 2223 |
| - | User betty | + | User betty |
| - | ForwardX11 yes | + | ForwardX11 yes |
| - | IdentityFile ~/ | + | IdentityFile ~/ |
| </ | </ | ||
| Then, when Betty calls needing assistance, all you need to type is 'ssh Betty' | Then, when Betty calls needing assistance, all you need to type is 'ssh Betty' | ||
| - | A nice thing to do, create an entry in / | + | Another |
| < | < | ||
| Cmnd_Alias SystemCTL = / | Cmnd_Alias SystemCTL = / | ||
| Line 169: | Line 174: | ||
| Note that the connections can be made as any user that has those keys, so if you copy AssistanceKey from secretuser to your own ~/.ssh/ then you shouldn' | Note that the connections can be made as any user that has those keys, so if you copy AssistanceKey from secretuser to your own ~/.ssh/ then you shouldn' | ||
| - | Another nice thing to do is to set up a [[Shared ' | + | Another nice thing to do is to set up a [[Shared ' |
remote_assistance.1697731595.txt.gz · Last modified: by steve
