SSH

How to change your host-name in CentOS

I knew how to do this in Ubuntu but doesn’t see to be the same in CentOS.

Here are the steps

Login via the console or SSH in
Goto /etc/sysconfig/
Type nano network
Change the HOSTNAME to your preferred servername
Press CTRL X > Y > Enter
Log off or reboot

There may be other methods, this one is mine

How do you ssh into a Linux

I know there is one person out there that may not know this, so I will share.

You you ask, how does one log into a remote Linux (UNIX) system using SSH.  Well the answer is simple.

If you are on a Linux (UNIX) system, open your terminal and use the following command:

ssh userid@server-ip (1.2.3.4)
ssh userid@server-name.something

Note:  userid means ‘your user name’

If you are using windows you can use an app named Putty

 

Byobu

Byobu is a light, powerful, text-based window manager based on GNU Screen. Using Byobu, you can quickly create and move between different windows over a single SSH connection or TTY terminal, monitor dozens of important statistics about your system, detach and reattach to sessions later while your programs continue to run in the background.

Byobu can be configured to run by default at every text login (SSH or TTY). That behavior can be toggled with the byobu-enable and byobu-disable commands.

In your remote ssh session type the following

byobu-enable

or

byobu-disable

Byobu displays two lines at the bottom of your screen. The upper one is the Caption line, and the lower one is the Hard Status

The Caption line shows your open windows, and highlights the one upon which you are focused, and optionally displays your user name, host name, IP address, and a hint that there is a Menu available if you press F9.

The Hard Status line consists of color coded output and symbols with configurable and dynamically updated facts, statistics, and information about the local system. See the Status Notifications section below for more information.

Some users may find the Hard Status line distracting. The byobu-quiet command will disable the display of the Hard Status. Append –undo to revert this configuration change.

Some other users may find both the Hard Status and Caption distracting. In this case, the byobu-silent command will disable both lines. Again, append –undo to revert the change.

 

Byobu provides a comprehensive, advanced set of commands bound to the F-keys on most keyboards.

F2 Create a new window
F3 Move to the next window
F4 Move to the previous window
F5 Refresh all status notifications
F6 Detach from the session and logout
Shift-F6 Detach from the session, but do not logout
F7 Enter scrollback/search mode
F8 Rename the current window
F9 Launch the Byobu Configuration Menu
F12 GNU Screen’s Escape Key
Alt-Pageup Scroll back through this window’s history
Alt-Pagedown Scroll forward through this window’s history
Shift-F2 Split the screen horizontally
Ctrl-F2 Split the screen vertically
Shift-F3 Move focus to the next split
Shift-F4 Move focus to the previous split
Shift-F5 Collapse all splits
Ctrl-F5 Reconnect any SSH/GPG sockets or agents
Ctrl-a-! Toggle all of Byobu’s keybindings on or off

SSH Server and Windows 7 w/ Cygwin

In order to install openssh server correctly for Windows 7, you will need to do the following:

  1. Install Cygwin in the normal way. Make sure you’ve got openssh and cygrunsrv as selected packages to install.
  2. Right-click the Cygwin shell icon, and Run as administrator.
  3. Run ssh-host-config. Follow the prompts carefully: if needed, it will tell you which permissions you need to set and where. Remember to say yes to privilege separation: it will create a user for you called cyg_runsrv which all cygwin services will run under in Windows 7.
  4. You should be able to start the service using cygrunsrv –-start sshd, or by starting it as a normal service under Administrative Tools > Services.
  5. This does not automatically create and open firewall rules, so you will have to do this manually.

Automate your SSH Login using PuTTY

Truth:  day-to-day tasks suck
To automate SSH login, do the following:
1. Run PuTTYgen.
2. Select SSH-2 DSA as the Type of Key to generate.
3. Click generate and move your mouse around to generate randomness.
4. Click “Save Private Key” and save it somewhere on your computer.
5. Copy the entire content inside the box to your clipboard (this is your generated public key).
6. Login to your SSH server.
7. Create the file ~/.ssh/authorized_keys containing the generated public key on a single line.
8. Make this file readable.
9. Then open up PuTTY and navigate to Connection->Data and fill in the auto-login username.
10. Navigate to Connection->SSH->Auth and under Private-key, browse to the file you had saved earlier on your computer.
That’s it!