Wednesday, February 22, 2012

6 useful SSH commands



OpenSSH is a FREE version of the SSH connectivity tools that technical users of the Internet rely on. Users of telnet, rlogin, and ftp may not realize that their password is transmitted across the Internet unencrypted, but it is. OpenSSH encrypts all traffic (including passwords) to effectively eliminate eavesdropping, connection hijacking, and other attacks. Additionally, OpenSSH provides secure tunneling capabilities and several authentication methods, and supports all SSH protocol versions.

In the following, there are 6 useful SSH commands:



1) COPY SSH KEYS TO USER@HOST TO ENABLE PASSWORD-LESS SSH LOGINS.
ssh-copy-id user@host
To generate the keys use the command ssh-keygen
Keys are needed for authentication of the users, some of the Linux users believe that the keys are the must of every system administrator.

2) START A TUNNEL FROM SOME MACHINE’S PORT 80 TO YOUR LOCAL POST 2001
ssh -N -L2001:localhost:80 somemachine
Now you can acces the website by going to http://localhost:2001/ .You can forward ports play tricks, or you can create your own proxy relay.

3) OUTPUT YOUR MICROPHONE TO A REMOTE COMPUTER’S SPEAKER
dd if=/dev/dsp | ssh -c arcfour -C username@host dd of=/dev/dsp
This will output the sound from your microphone port to the ssh target computer’s speaker port. The sound quality is very bad, so you will hear a lot of hissing.  Heaven for every pranker.


4) COMPARE A REMOTE FILE WITH A LOCAL FILE
ssh user@host cat /path/to/remotefile | diff /path/to/localfile -
Useful for checking if there are differences between local and remote files. Copying configuration files will never be boring again.

5) MOUNT FOLDER/FILESYSTEM THROUGH SSH
sshfs name@server:/path/to/folder /path/to/mount/point
Install SSHFS from http://fuse.sourceforge.net/sshfs.html .Will allow you to mount a folder security over a network.

6) SSH CONNECTION THROUGH HOST IN THE MIDDLE
ssh -t reachable_host ssh unreachable_host
Unreachable_host is unavailable from local network, but it’s available from reachable_host’s network. This command creates a connection to unreachable_host through “hidden” connection to reachable_host.

0 comments:

Post a Comment