jfgiraud

Untitled

Jun 22nd, 2023
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. IPHOST=$(ipconfig /all | grep Passe | cut -d':' -f2 | tr -sd ' ' | tr -d '\r')
  4.  
  5. echo "IPHOST=$IPHOST"
  6.  
  7. read -p "Quel est votre user (cuid) ? " USER
  8.  
  9. if [ ! -e /etc/sshd_config ]; then
  10. cat > /etc/sshd_config <<EOF
  11. Port 22
  12. AuthorizedKeysFile .ssh/authorized_keys
  13. AllowTcpForwarding yes
  14. X11Forwarding yes
  15. Subsystem sftp /bin/sftp-server
  16. EOF
  17. fi
  18.  
  19. sleep 1
  20. echo "Start sshd in background..."
  21. ssh-keygen -A
  22. /usr/bin/sshd
  23. sleep 1
  24. echo ssh -N -R 2222:127.0.0.1:22 $USER@$IPHOST
  25. ssh -N -R 2222:127.0.0.1:22 $USER@$IPHOST
Advertisement
Add Comment
Please, Sign In to add comment