Datasets:

Languages:
English
Size:
n<1K
ArXiv:
License:
File size: 6,258 Bytes
dd86a22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9c0a350
7d44f01
 
dd86a22
 
 
 
 
 
 
 
 
 
 
 
7d44f01
a5d9c3e
7d44f01
a5d9c3e
 
7d44f01
 
 
 
 
 
 
 
 
dd86a22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7d44f01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dd86a22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7d44f01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a5d9c3e
 
 
 
 
 
 
 
7d44f01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a5d9c3e
7d44f01
 
 
 
dd86a22
 
a5d9c3e
7d44f01
 
 
 
 
dd86a22
a5d9c3e
 
dd86a22
7d44f01
 
 
 
 
 
 
 
dd86a22
a5d9c3e
 
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
#!/bin/bash

# OSWorld VNC Setup Script
# Run this script on a fresh Ubuntu system

set -e  # Exit on any error

echo "=== OSWorld VNC Setup Script ==="
echo "Setting up VNC and OSWorld server..."

# Update system
echo "Updating system packages..."
sudo apt update

# Install required packages
echo "Installing required packages..."
sudo apt install -y \
    x11vnc \
    xserver-xorg-video-dummy \
    python3 \
    python3-pip \
    python3-tk \
    python3-dev \
    gnome-screenshot \
    wmctrl \
    ffmpeg \
    socat \
    xclip \
    git \
    openssh-server \
    tigervnc-common

# Install noVNC
echo "Installing noVNC..."
sudo snap install novnc

# Install dummy video driver (already included above, but ensuring it's there)
echo "Ensuring dummy video driver is installed..."
sudo apt-get install -y xserver-xorg-video-dummy

# Set up VNC password
echo "Setting up VNC password..."
mkdir -p ~/.vnc

# Create VNC password file using interactive method
echo "Creating VNC password file..."
echo "Please enter VNC password when prompted (recommended: osworld-public-evaluation)"
x11vnc -storepasswd ~/.vnc/passwd
chmod 600 ~/.vnc/passwd

# Verify password file was created
if [ -f ~/.vnc/passwd ]; then
    echo "✅ VNC password file created successfully"
else
    echo "❌ Failed to create VNC password file"
    exit 1
fi

# Create X11 configuration
echo "Creating X11 configuration..."
sudo tee /etc/X11/xorg.conf > /dev/null << 'EOF'
Section "Device"
    Identifier "DummyDevice"
    Driver "dummy"
    VideoRam 256000
EndSection

Section "Monitor"
    Identifier "DummyMonitor"
    HorizSync 28.0-80.0
    VertRefresh 48.0-75.0
    Modeline "1920x1080" 172.80 1920 2048 2248 2576 1080 1083 1088 1120
EndSection

Section "Screen"
    Identifier "DummyScreen"
    Device "DummyDevice"
    Monitor "DummyMonitor"
    DefaultDepth 24
    SubSection "Display"
        Depth 24
        Modes "1920x1080"
    EndSubSection
EndSection
EOF

# Enable and start SSH service
echo "Enabling and starting SSH service..."
sudo systemctl enable ssh
sudo systemctl start ssh

# Check SSH service status
echo "Checking SSH service status..."
sudo systemctl status ssh --no-pager -l

# Ensure SSH allows password authentication
echo "Configuring SSH..."
sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
sudo sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config

# Restart SSH service to apply configuration changes
echo "Restarting SSH service..."
sudo systemctl restart ssh

# Check if SSH is listening on port 22
echo "Verifying SSH is listening on port 22..."
sudo netstat -tlnp | grep :22

# Create systemd user directory if it doesn't exist
mkdir -p ~/.config/systemd/user

# Create x11vnc service with password authentication
echo "Creating x11vnc service..."
tee ~/.config/systemd/user/x11vnc.service > /dev/null << 'EOF'
[Unit]
Description=X11 VNC Server
After=graphical-session.target
Wants=graphical-session.target

[Service]
Type=simple
ExecStart=/bin/bash -c 'sleep 5 && sudo chown $USER:$USER /tmp/.X11-unix/X0 2>/dev/null || true && x11vnc -display :0 -rfbport 5900 -forever -shared -noxdamage -noxfixes -noxrandr -rfbauth ~/.vnc/passwd'
Restart=on-failure
RestartSec=5
Environment=DISPLAY=:0

[Install]
WantedBy=default.target
EOF

# Create noVNC service
echo "Creating noVNC service..."
tee ~/.config/systemd/user/novnc.service > /dev/null << 'EOF'
[Unit]
Description=noVNC Service
After=x11vnc.service network.target
Wants=x11vnc.service

[Service]
Type=simple
ExecStart=/snap/bin/novnc --vnc localhost:5900 --listen 5910
Restart=on-failure
RestartSec=5
Environment=DISPLAY=:0

[Install]
WantedBy=default.target
EOF

# Set up OSWorld server directory
echo "Setting up OSWorld server directory..."
mkdir -p /home/user/server

# Enable systemd services
echo "Enabling systemd services..."
systemctl --user daemon-reload
systemctl --user enable x11vnc.service
systemctl --user enable novnc.service

# Create manual startup script
echo "Creating manual startup script..."
tee ~/start_vnc.sh > /dev/null << 'EOF'
#!/bin/bash

echo "Starting VNC services manually..."

# Stop any existing services
sudo pkill -f x11vnc
sudo pkill -f novnc
sudo pkill -f websockify
sleep 2

# Set DISPLAY environment variable
export DISPLAY=:0

# Check if password file exists
if [ ! -f ~/.vnc/passwd ]; then
    echo "VNC password file not found. Creating one..."
    echo "Please enter VNC password when prompted:"
    x11vnc -storepasswd ~/.vnc/passwd
    chmod 600 ~/.vnc/passwd
fi

# Start x11vnc with password
echo "Starting x11vnc..."
x11vnc -display :0 -rfbport 5900 -forever -shared -noxdamage -noxfixes -noxrandr -rfbauth ~/.vnc/passwd &

# Wait for x11vnc to start
sleep 3

# Start noVNC
echo "Starting noVNC..."
/snap/bin/novnc --vnc localhost:5900 --listen 5910 &

# Wait for services to start
sleep 2

# Check status
echo "=== Service Status ==="
echo "x11vnc process:"
ps aux | grep x11vnc | grep -v grep

echo "noVNC process:"
ps aux | grep novnc | grep -v grep

echo "Port status:"
netstat -tlnp | grep -E "(5900|5910)"

echo ""
echo "VNC services started!"
echo "Connect via: http://<server-ip>:5910"
echo "Use the password you set during setup"
EOF

chmod +x ~/start_vnc.sh

echo "=== Setup Complete ==="
echo ""
echo "✅ VNC password has been set interactively"
echo "✅ SSH service has been enabled and started"
echo "✅ SystemD services have been created and enabled"
echo "✅ Manual startup script created: ~/start_vnc.sh"
echo ""
echo "Connection methods:"
echo "- SSH: ssh user@<server-ip> (use system user password)"
echo "- VNC client: <server-ip>:5900 (use the password you set)"
echo "- noVNC web: http://<server-ip>:5910 (use the password you set)"
echo ""
echo "To start VNC services manually:"
echo "  ./start_vnc.sh"
echo ""
echo "To start VNC services via systemd:"
echo "  systemctl --user start x11vnc.service"
echo "  systemctl --user start novnc.service"
echo ""
echo "SSH service is running on port 22"
echo ""
echo "IMPORTANT: The VNC password was set interactively during setup."
echo "If you forget it, run: x11vnc -storepasswd ~/.vnc/passwd to reset it."