Monday, August 30, 2010

ssh Secrets Summary

  1. Run Command on Remote System Without Logging In

    user@user-laptop:~$ ssh tony date
    Mon Aug 30 19:08:40 SPT 2010

    For Program needing pseudo-tty use -t option of ssh. For eg:
    user@user-laptop:~$ ssh tony -t top
    user@user-laptop:~$ ssh tony -t screen -dr

  2. Tilde Tricks

    Tilde (~) is ssh's escape character.
    ~. terminate ssh connection. Specially useful when you loose connection and don't want to wait for ssh timeout.
    ~^z put the connection in background
    ~? list all key sequence

  3. ssh-keygen -R removes bad hostname from your ssh know host

  4. Shortcut Name For Connection

    In ~/.ssh/config enter the following information
    Host bob
         HostName bob.example.com
         Port 2222
         User username

    Host alice
         HostName alice.example.com
         Port 8183
         User username
    now to ssh
    user@user:~$ ssh bob
    user@user:~$ ssh alice
Summarized from http://blog.ksplice.com/2010/08/six-things-i-wish-mom-told-me-about-ssh/

2 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete