forked from CONIGUERO/fastmac-VNCgui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.sh
55 lines (41 loc) · 2.11 KB
/
configure.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#configure.sh VNC_USER_PASSWORD VNC_PASSWORD TAILSCALE_AUTH_KEY NGROK_AUTH_TOKEN
#disable spotlight indexing
sudo mdutil -i off -a
#Create new account
sudo dscl . -create /Users/vncuser
sudo dscl . -create /Users/vncuser UserShell /bin/bash
sudo dscl . -create /Users/vncuser RealName "VNC User"
sudo dscl . -create /Users/vncuser UniqueID 1001
sudo dscl . -create /Users/vncuser PrimaryGroupID 80
sudo dscl . -create /Users/vncuser NFSHomeDirectory /Users/vncuser
sudo dscl . -passwd /Users/vncuser $1
sudo dscl . -passwd /Users/vncuser $1
sudo createhomedir -c -u vncuser > /dev/null
#Enable VNC
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -allUsers -privs -all
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setvnclegacy -vnclegacy yes
#VNC password - http://hints.macworld.com/article.php?story=20071103011608872
echo $2 | perl -we 'BEGIN { @k = unpack "C*", pack "H*", "1734516E8BA8C5E2FF1C39567390ADCA"}; $_ = <>; chomp; s/^(.{8}).*/$1/; @p = unpack "C*", $_; foreach (@k) { printf "%02X", $_ ^ (shift @p || 0) }; print "\n"' | sudo tee /Library/Preferences/com.apple.VNCSettings.txt
#Start VNC/reset changes
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -restart -agent -console
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate
# install go
brew unlink [email protected]
brew install go || brew link --overwrite go
#install tailscale
go install tailscale.com/cmd/tailscale{,d}@main
#add gopath to path
echo "export PATH=$(go env GOPATH)/bin:$PATH" >> "$HOME/.zshrc"
#install the tailscale daemon
sudo $HOME/go/bin/tailscaled install-system-daemon
#configure tailscale
sudo $HOME/go/bin/tailscale up --authkey $3
#install reattach-to-user-namespace
brew install reattach-to-user-namespace
#configure tmux
echo "set-option -g default-command 'reattach-to-user-namespace -l zsh'" >> "$HOME/.tmux.conf"
#install ngrok
brew install --cask ngrok
#configure ngrok and start it
ngrok authtoken $4
ngrok tcp 5900 &