Datasets:

Languages:
English
Size:
n<1K
ArXiv:
License:
tianbaoxiexxx commited on
Commit
7d44f01
·
verified ·
1 Parent(s): 9c0a350

Upload aliyun_config.sh

Browse files
Files changed (1) hide show
  1. aliyun_config.sh +101 -31
aliyun_config.sh CHANGED
@@ -27,7 +27,8 @@ sudo apt install -y \
27
  socat \
28
  xclip \
29
  git \
30
- openssh-server
 
31
 
32
  # Install noVNC
33
  echo "Installing noVNC..."
@@ -40,7 +41,19 @@ sudo apt-get install -y xserver-xorg-video-dummy
40
  # Set up VNC password
41
  echo "Setting up VNC password..."
42
  mkdir -p ~/.vnc
 
 
 
43
  echo "osworld-public-evaluation" | x11vnc -storepasswd /dev/stdin ~/.vnc/passwd
 
 
 
 
 
 
 
 
 
44
 
45
  # Create X11 configuration
46
  echo "Creating X11 configuration..."
@@ -70,6 +83,29 @@ Section "Screen"
70
  EndSection
71
  EOF
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  # Create systemd user directory if it doesn't exist
74
  mkdir -p ~/.config/systemd/user
75
 
@@ -115,46 +151,80 @@ EOF
115
  echo "Setting up OSWorld server directory..."
116
  mkdir -p /home/user/server
117
 
118
- # Enable and start SSH service
119
- echo "Enabling and starting SSH service..."
120
- sudo systemctl enable ssh
121
- sudo systemctl start ssh
122
-
123
- # Check SSH service status
124
- echo "Checking SSH service status..."
125
- sudo systemctl status ssh --no-pager -l
126
-
127
- # Ensure SSH allows password authentication
128
- echo "Configuring SSH..."
129
- sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
130
- sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
131
- sudo sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
132
-
133
- # Restart SSH service to apply configuration changes
134
- echo "Restarting SSH service..."
135
- sudo systemctl restart ssh
136
-
137
- # Check if SSH is listening on port 22
138
- echo "Verifying SSH is listening on port 22..."
139
- sudo netstat -tlnp | grep :22
140
-
141
  # Enable systemd services
142
  echo "Enabling systemd services..."
143
  systemctl --user daemon-reload
144
  systemctl --user enable x11vnc.service
145
  systemctl --user enable novnc.service
146
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  echo "=== Setup Complete ==="
148
- echo "VNC password has been set to: osworld-public-evaluation"
149
- echo "SSH service has been enabled and started"
150
  echo ""
151
- echo "You can now connect via:"
 
 
 
 
 
152
  echo "- SSH: ssh user@<server-ip> (use system user password)"
153
  echo "- VNC client: <server-ip>:5900 (password: osworld-public-evaluation)"
154
  echo "- noVNC web: http://<server-ip>:5910 (password: osworld-public-evaluation)"
155
  echo ""
156
- echo "To start the VNC services manually, run:"
157
- echo "systemctl --user start x11vnc.service"
158
- echo "systemctl --user start novnc.service"
 
 
 
 
 
159
  echo ""
160
- echo "SSH service is now running on port 22"
 
27
  socat \
28
  xclip \
29
  git \
30
+ openssh-server \
31
+ tigervnc-common
32
 
33
  # Install noVNC
34
  echo "Installing noVNC..."
 
41
  # Set up VNC password
42
  echo "Setting up VNC password..."
43
  mkdir -p ~/.vnc
44
+
45
+ # Create VNC password file using x11vnc
46
+ echo "Creating VNC password file..."
47
  echo "osworld-public-evaluation" | x11vnc -storepasswd /dev/stdin ~/.vnc/passwd
48
+ chmod 600 ~/.vnc/passwd
49
+
50
+ # Verify password file was created
51
+ if [ -f ~/.vnc/passwd ]; then
52
+ echo "✅ VNC password file created successfully"
53
+ else
54
+ echo "❌ Failed to create VNC password file"
55
+ exit 1
56
+ fi
57
 
58
  # Create X11 configuration
59
  echo "Creating X11 configuration..."
 
83
  EndSection
84
  EOF
85
 
86
+ # Enable and start SSH service
87
+ echo "Enabling and starting SSH service..."
88
+ sudo systemctl enable ssh
89
+ sudo systemctl start ssh
90
+
91
+ # Check SSH service status
92
+ echo "Checking SSH service status..."
93
+ sudo systemctl status ssh --no-pager -l
94
+
95
+ # Ensure SSH allows password authentication
96
+ echo "Configuring SSH..."
97
+ sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
98
+ sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
99
+ sudo sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
100
+
101
+ # Restart SSH service to apply configuration changes
102
+ echo "Restarting SSH service..."
103
+ sudo systemctl restart ssh
104
+
105
+ # Check if SSH is listening on port 22
106
+ echo "Verifying SSH is listening on port 22..."
107
+ sudo netstat -tlnp | grep :22
108
+
109
  # Create systemd user directory if it doesn't exist
110
  mkdir -p ~/.config/systemd/user
111
 
 
151
  echo "Setting up OSWorld server directory..."
152
  mkdir -p /home/user/server
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  # Enable systemd services
155
  echo "Enabling systemd services..."
156
  systemctl --user daemon-reload
157
  systemctl --user enable x11vnc.service
158
  systemctl --user enable novnc.service
159
 
160
+ # Create manual startup script
161
+ echo "Creating manual startup script..."
162
+ tee ~/start_vnc.sh > /dev/null << 'EOF'
163
+ #!/bin/bash
164
+
165
+ echo "Starting VNC services manually..."
166
+
167
+ # Stop any existing services
168
+ sudo pkill -f x11vnc
169
+ sudo pkill -f novnc
170
+ sudo pkill -f websockify
171
+ sleep 2
172
+
173
+ # Set DISPLAY environment variable
174
+ export DISPLAY=:0
175
+
176
+ # Start x11vnc with password
177
+ echo "Starting x11vnc..."
178
+ x11vnc -display :0 -rfbport 5900 -forever -shared -noxdamage -noxfixes -noxrandr -rfbauth ~/.vnc/passwd &
179
+
180
+ # Wait for x11vnc to start
181
+ sleep 3
182
+
183
+ # Start noVNC
184
+ echo "Starting noVNC..."
185
+ /snap/bin/novnc --vnc localhost:5900 --listen 5910 &
186
+
187
+ # Wait for services to start
188
+ sleep 2
189
+
190
+ # Check status
191
+ echo "=== Service Status ==="
192
+ echo "x11vnc process:"
193
+ ps aux | grep x11vnc | grep -v grep
194
+
195
+ echo "noVNC process:"
196
+ ps aux | grep novnc | grep -v grep
197
+
198
+ echo "Port status:"
199
+ netstat -tlnp | grep -E "(5900|5910)"
200
+
201
+ echo ""
202
+ echo "VNC services started!"
203
+ echo "Connect via: http://<server-ip>:5910"
204
+ echo "Password: osworld-public-evaluation"
205
+ EOF
206
+
207
+ chmod +x ~/start_vnc.sh
208
+
209
  echo "=== Setup Complete ==="
 
 
210
  echo ""
211
+ echo " VNC password has been set to: osworld-public-evaluation"
212
+ echo "✅ SSH service has been enabled and started"
213
+ echo "✅ SystemD services have been created and enabled"
214
+ echo "✅ Manual startup script created: ~/start_vnc.sh"
215
+ echo ""
216
+ echo "Connection methods:"
217
  echo "- SSH: ssh user@<server-ip> (use system user password)"
218
  echo "- VNC client: <server-ip>:5900 (password: osworld-public-evaluation)"
219
  echo "- noVNC web: http://<server-ip>:5910 (password: osworld-public-evaluation)"
220
  echo ""
221
+ echo "To start VNC services manually:"
222
+ echo " ./start_vnc.sh"
223
+ echo ""
224
+ echo "To start VNC services via systemd:"
225
+ echo " systemctl --user start x11vnc.service"
226
+ echo " systemctl --user start novnc.service"
227
+ echo ""
228
+ echo "SSH service is running on port 22"
229
  echo ""
230
+ echo "Note: If systemd services don't work, use the manual startup script."