Skip to content

Instantly share code, notes, and snippets.

@davidalger
Last active February 20, 2023 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidalger/492ad25071b96a7358c0c8fb8cbb1065 to your computer and use it in GitHub Desktop.
Save davidalger/492ad25071b96a7358c0c8fb8cbb1065 to your computer and use it in GitHub Desktop.
Remote Linux Console Access

Where SSH is available, this is probably the more simple and definitely more secure option

  • Create admin user on the server-side (root is typically dissallowed by default)

    useradd -G wheel davidalger
    passwd davidalger
    
  • Connect from the client-side via SSH

Where SSH is unavailable, use socat to start a shell when you connect from the client machine:

  • From the linux console, temporarily open a tcp port

    firewall-cmd --add-port=5555/tcp --timeout=5m
    
  • Start socat on server

    socat tcp-listen:5555,reuseaddr exec:bash,pty,stderr,setsid,sigint,login
    

    Note: Be aware that this will all be plaintext over the wire, so only do this on a private and secure network where MITM is not of a serious concern.

  • From the client machine, connect via TCP using Serial (or if you desire to, it's possible to run socat client-side linking the shell session to a local file, which can be used with screen)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment