@@ -12,19 +12,16 @@ First, define the template. We install OpenSSH server and [websocat](https://git
1212import { Template , waitForPort } from ' e2b'
1313
1414export const template = Template ()
15- .fromUbuntuImage (' 22 .04' )
16- // Install SSH server, curl for downloading websocat, and sudo for start command
17- .aptInstall ([' openssh-server' , ' curl ' , ' sudo ' ])
18- // Configure SSH and download websocat (requires root)
15+ .fromUbuntuImage (' 25 .04' )
16+ // Install SSH server
17+ .aptInstall ([' openssh-server' ])
18+ // Download websocat (requires root)
1919 .runCmd ([
2020 ' curl -fsSL -o /usr/local/bin/websocat https://github.com/vi/websocat/releases/latest/download/websocat.x86_64-unknown-linux-musl' ,
2121 ' chmod a+x /usr/local/bin/websocat' ,
22- " sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config" ,
23- ' echo "user:sandbox" | chpasswd' ,
24- ' echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers' ,
2522 ], { user: ' root' })
26- // Start SSH daemon and WebSocket proxy on port 8081
27- .setStartCmd (' sudo mkdir -p /run/sshd && sudo ssh-keygen -A && sudo /usr/sbin/sshd && websocat -b --exit-on-eof ws-l:0.0.0.0:8081 tcp:127.0.0.1:22' , waitForPort (8081 ))
23+ // Start WebSocket proxy on port 8081
24+ .setStartCmd (' sudo websocat -b --exit-on-eof ws-l:0.0.0.0:8081 tcp:127.0.0.1:22' , waitForPort (8081 ))
2825```
2926
3027``` python Python
@@ -33,19 +30,16 @@ from e2b import Template, wait_for_port
3330
3431template = (
3532 Template()
36- .from_ubuntu_image(" 22 .04" )
37- # Install SSH server, curl for downloading websocat, and sudo for start command
38- .apt_install([" openssh-server" , " curl " , " sudo " ])
39- # Configure SSH and download websocat (requires root)
33+ .from_ubuntu_image(" 25 .04" )
34+ # Install SSH server
35+ .apt_install([" openssh-server" ])
36+ # Download websocat (requires root)
4037 .run_cmd([
4138 " curl -fsSL -o /usr/local/bin/websocat https://github.com/vi/websocat/releases/latest/download/websocat.x86_64-unknown-linux-musl" ,
4239 " chmod a+x /usr/local/bin/websocat" ,
43- " sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config" ,
44- ' echo "user:sandbox" | chpasswd' ,
45- ' echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers' ,
4640 ], user = " root" )
47- # Start SSH daemon and WebSocket proxy on port 8081
48- .set_start_cmd(" sudo mkdir -p /run/sshd && sudo ssh-keygen -A && sudo /usr/sbin/sshd && websocat -b --exit-on-eof ws-l:0.0.0.0:8081 tcp:127.0.0.1:22" , wait_for_port(8081 ))
41+ # Start WebSocket proxy on port 8081
42+ .set_start_cmd(" sudo websocat -b --exit-on-eof ws-l:0.0.0.0:8081 tcp:127.0.0.1:22" , wait_for_port(8081 ))
4943)
5044```
5145
0 commit comments