wthiel / Ubuntu User Setup Script

0 лайк(-ов)
0 форк(-ов)
2 файл(-ов)
Последняя активность 4 months ago
Creates user account, sets up SSH keys from GitHub, and optionally grants sudo privileges
1 #!/bin/bash
2
3 # Ubuntu User Setup Script
4 # Creates user account, sets up SSH keys from GitHub, and optionally grants sudo privileges
5 # Must be run as root
6
7 set -e # Exit on any error
8
9 # Color codes for output
10 RED='\033[0;31m'

wthiel / Public Keys

0 лайк(-ов)
0 форк(-ов)
2 файл(-ов)
Последняя активность 4 months ago
1 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILB5bVuBHYwgtCL+ppoOkKSpu/+wmSOt80yVE/S2qU0F wthiel

wthiel / Elevated Powershell Example

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 4 months ago
This script ensures that it runs with administrator privileges before executing the actual code. If no admin rights are available, it restarts itself with elevated privileges.
1 param([switch]$Elevated)
2
3 function Test-Admin {
4 $currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
5 $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
6 }
7
8 if ((Test-Admin) -eq $false) {
9 if ($elevated) {
10 # tried to elevate, did not work, aborting
Новее Позже