Skip to content

Commit

Permalink
switch to root user
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-lombardi committed Jan 2, 2025
1 parent ceb3bd2 commit a98f1b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions pkg/abstractions/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,16 @@ func (ss *SSHShellService) CreateShell(ctx context.Context, in *pb.CreateShellRe

startupCommand := fmt.Sprintf(`
set -e;
USERNAME='beam';
USERNAME='root';
TOKEN='%s';
useradd -m -s /bin/bash "$USERNAME";
echo "$USERNAME:$TOKEN" | chpasswd;
echo "cd /mnt/code" >> "/home/$USERNAME/.bashrc";
echo "if [ -f /root/.bashrc ]; then . /root/.bashrc; fi" >> "/root/.profile";
echo "cd /mnt/code" >> "/root/.profile";
echo "export TERM=xterm-256color" >> "/root/.bashrc";
echo "alias ls='ls --color=auto'" >> "/root/.bashrc";
echo "alias ll='ls -lart --color=auto'" >> "/root/.bashrc";
sed -i 's/^#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config;
sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config;
sed -i 's/^#PubkeyAuthentication.*/PubkeyAuthentication no/' /etc/ssh/sshd_config;
echo "AllowUsers $USERNAME" >> /etc/ssh/sshd_config;
exec /usr/sbin/sshd -D -p 8001
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/beta9/abstractions/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def shell(self, url_type: str = ""):
container_id=container_id,
stub_id=self.parent.stub_id,
auth_token=self.parent.config_context.token,
username="beam",
username="root",
password=ssh_token,
) as shell:
shell.start()

0 comments on commit a98f1b1

Please sign in to comment.