diff options
| author | hc <hc@email.ch> | 2025-01-02 09:26:32 +0800 |
|---|---|---|
| committer | hc <hc@email.ch> | 2025-01-02 09:26:32 +0800 |
| commit | c33f0979f0312e7a6d43645aa0a5d5b1481751f5 (patch) | |
| tree | 49bd07cf9b6f02572586d22f3794da007bf794d1 /others/vm3/.config/cloud-init-generator | |
| parent | 181bc10748cd9162e85f16722d6c83ff04a2d39d (diff) | |
udpated
Diffstat (limited to 'others/vm3/.config/cloud-init-generator')
| -rwxr-xr-x | others/vm3/.config/cloud-init-generator/debian12.sh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/others/vm3/.config/cloud-init-generator/debian12.sh b/others/vm3/.config/cloud-init-generator/debian12.sh index 5e4d7fb..de0751f 100755 --- a/others/vm3/.config/cloud-init-generator/debian12.sh +++ b/others/vm3/.config/cloud-init-generator/debian12.sh | |||
| @@ -40,15 +40,17 @@ else | |||
| 40 | --run-command 'useradd -m -s /bin/bash user' \ | 40 | --run-command 'useradd -m -s /bin/bash user' \ |
| 41 | $SSH_INJECT_OPTS \ | 41 | $SSH_INJECT_OPTS \ |
| 42 | --update \ | 42 | --update \ |
| 43 | --install openssh-server,git \ | 43 | --install openssh-server,git,cloud-guest-utils,tmux \ |
| 44 | --run-command 'echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/user' \ | 44 | --run-command 'echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/user' \ |
| 45 | --run-command 'sed -i "s/PermitRootLogin yes/PermitRootLogin no/" /etc/ssh/sshd_config' \ | 45 | --run-command 'sed -i "s/PermitRootLogin yes/PermitRootLogin no/" /etc/ssh/sshd_config' \ |
| 46 | --run-command 'sed -i "s/#PasswordAuthentication yes/PasswordAuthentication no/" /etc/ssh/sshd_config' \ | 46 | --run-command 'sed -i "s/#PasswordAuthentication yes/PasswordAuthentication no/" /etc/ssh/sshd_config' \ |
| 47 | --run-command 'cd /home/user && git clone https://git.0nom.ch/keys && chown -R user:user keys && sudo -u user ./keys/add-ssh-keys.sh' \ | 47 | --run-command 'cd /home/user && git clone https://git.0nom.ch/keys && chown -R user:user keys && sudo -u user ./keys/add-ssh-keys.sh' \ |
| 48 | --run-command 'tee -a /etc/bashrc > /dev/null << "EOF" | 48 | --run-command 'tee -a /etc/bash.bashrc > /dev/null << "EOF" |
| 49 | LS_COLORS=$LS_COLORS:'\''di=38;5;135:ex=00;32:'\'' ; export LS_COLORS | 49 | LS_COLORS=$LS_COLORS:'\''di=38;5;135:ex=00;32:'\'' ; export LS_COLORS |
| 50 | PS1='\''[\[\033[01;32m\]\u\[\033[00m\]@\h \[\033[38;5;135m\]\W\[\033[00m\]]\$ '\'' | 50 | PS1='\''[\[\033[01;32m\]\u\[\033[00m\]@\h \[\033[38;5;135m\]\W\[\033[00m\]]\$ '\'' |
| 51 | EOF' && \ | 51 | EOF' \ |
| 52 | --run-command 'echo "sudo growpart /dev/vda 1 && sudo resize2fs /dev/vda1 && source /etc/bash.bashrc" > /home/user/start.sh && chmod +x /home/user/start.sh' && \ | ||
| 53 | |||
| 52 | # Create flag file after successful customization | 54 | # Create flag file after successful customization |
| 53 | sudo touch "$flag_file" | 55 | sudo touch "$flag_file" |
| 54 | fi | 56 | fi |
