Difference between revisions of "Secure Shell"
(→Reverse SSH) |
(→Reverse SSH) |
||
Line 16: | Line 16: | ||
ssh -p 2210 username@localhost | ssh -p 2210 username@localhost | ||
− | Open a port tunnel on port | + | Open a port tunnel on port 443 through ssh from one computer into another, perform a keepalive request, and prevent ssh from reconnecting if the connection is already established: |
ssh -XYC -R 443:127.0.0.1:443 -N -f -o ExitOnForwardFailure=yes -o ServerAliveInterval=60 user@domain.com | ssh -XYC -R 443:127.0.0.1:443 -N -f -o ExitOnForwardFailure=yes -o ServerAliveInterval=60 user@domain.com | ||
− | This will allow you to get around any port issues on the first network by using domain.com's network to "forward" the port over ssh to the first device. | + | This will allow you to get around any port issues on the first network by using domain.com's network to "forward" the port over ssh to the first device. This can be installed to cronie to keep the connection going with the following example: |
+ | |||
+ | if ps aux |grep "root@domain.com" |grep -vi grep |grep 443 ; then exit 0; else ssh -XYC -R 443:127.0.0.1:443 -N -f -o ExitOnForwardFailure=yes -o ServerAliveInterval=60 root@domain.com ; fi |
Revision as of 15:30, 8 September 2021
Secure Shell, or SSH, is a cryptographic (encrypted) network protocol to allow remote login and other network services to operate securely over an unsecured network.
SSH provides a secure channel over an unsecured network in a client-server architecture, connecting an SSH client application with an SSH server. Common applications include remote command-line login and remote command execution, but any network service can be secured with SSH. The protocol specification distinguishes between two major versions, referred to as SSH-1 and SSH-2.
The most visible application of the protocol is for access to shell accounts on Unix-like operating systems, but it sees some limited use on Windows as well. In 2015, Microsoft announced that they would include native support for SSH in a future release.
SSH was designed as a replacement for Telnet and for unsecured remote shell protocols such as the Berkeley rlogin, rsh, and rexec protocols. Those protocols send information, notably passwords, in plaintext, rendering them susceptible to interception and disclosure using packet analysis. The encryption used by SSH is intended to provide confidentiality and integrity of data over an unsecured network, such as the Internet, although files leaked by Edward Snowden indicate that the National Security Agency can sometimes decrypt SSH, allowing them to read the content of SSH sessions.
Reverse SSH
You can initiate SSH using SSH in case you do not have access to the local firewall or something else. On the machine you want to SSH to, run the following:
ssh –R 2210:localhost:22 username@domain.com
On the other computer that you want to ssh from, run the following:
ssh -p 2210 username@localhost
Open a port tunnel on port 443 through ssh from one computer into another, perform a keepalive request, and prevent ssh from reconnecting if the connection is already established:
ssh -XYC -R 443:127.0.0.1:443 -N -f -o ExitOnForwardFailure=yes -o ServerAliveInterval=60 user@domain.com
This will allow you to get around any port issues on the first network by using domain.com's network to "forward" the port over ssh to the first device. This can be installed to cronie to keep the connection going with the following example:
if ps aux |grep "root@domain.com" |grep -vi grep |grep 443 ; then exit 0; else ssh -XYC -R 443:127.0.0.1:443 -N -f -o ExitOnForwardFailure=yes -o ServerAliveInterval=60 root@domain.com ; fi