Skip to content

Instantly share code, notes, and snippets.

@DiegoAscanio
Created October 28, 2025 16:14
Show Gist options
  • Select an option

  • Save DiegoAscanio/6e5bced5cbd4475497df272150450eba to your computer and use it in GitHub Desktop.

Select an option

Save DiegoAscanio/6e5bced5cbd4475497df272150450eba to your computer and use it in GitHub Desktop.
#!/bin/bash
# 1. crio o usuário cefetmg
useradd -m cefetmg -s /bin/bash
# 2. defino a senha do usuário cefetmg
echo "cefetmg:cefetmg" | chpasswd
# 3. gero chaves pro sshd
ssh-keygen -A
# 4. inicio o serviço sshd pela linha de comando
/usr/sbin/sshd -f /etc/ssh/sshd_config -D &
# 5. pego o IP da máquina
IP=$(ip a sh dev eth0 | grep "inet " | awk '{print $2}' | cut -d/ -f1)
echo "O IP da máquina é: $IP"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment