May 31 2017

1and1 releases Cloud-Init support for NGCS

So it appears that 1&1 has silently released an update to their CloudPanel products to support the Cloud-Init functionality. This is the same functionality seen with AWS, Linode, and others where you can configure things to happen for your server upon creation. The ultimate goal, for those unfamiliar, is to try to allievate some of the hassles associated with creating servers where you need to do trivial tasks like install applications, create users, etc. For MailServer customers, this is great because by default 1&1 Images still install with the HOSTNAME set to localhost.localdomain which will get you blacklisted if you’re not speedy enough to resolve it before your first email is sent. (For more information on a MailServer checklist).

For information on what Cloud-Init can do, read up at https://cloudinit.readthedocs.io to get some great examples and perfect use cases. The net is also swimming in guides by other people. One that I ran today for a test run, as I’ve never had the pleasure of using the system before, was as follows:

#cloud-config 
users:  
 - name: tgarrity
  gecos: Tim Garrity  
  sudo: ['ALL=(ALL) NOPASSWD:ALL']  
  groups: wheel  
  ssh-authorized-keys:  
    - ssh-rsa ABCDE...12345 vm-key
package_upgrade: true
fqdn: server1.diyserver.guide
hostname: server1
manage_etc_hosts: true
disable_root: true

Short and simple, create a new user for me outside of the root user, disabled root so it can only be used during KVM, and set the hostname.

March 28 2016

CentOS 7 | Reset Root Password | Grub Method

Imagine the situation where your Administrator is fired/quits, and with him takes the root password of the server and need access to the server right now. Fortunately, Linux makes the process incredibly easy since you have local access, at least in the eyes of the Linux OS. All this method requires is the ability to manipulate GRUB, so if you have a way of seeing the grub menu and working with it, then this method is for you.

Let’s Get Started

  1. Reboot the server and get to the Grub Menu
  2. Go to the line that says “linux16”.
    1. There’s going to be a few more lines compared to CentOS6‘s method, just scroll slowly, it’s there.
  3. Using the Right arrow, go into the “linux16” line and find the word “ro”.
    1. This is telling the server to boot into Read Only. The server boots that and then upon login/mounting you get a Read/Write access. We want to bypass that.
  4. Change “ro” to “rw” and follow it up with “init=/sysroot/bin/sh”
    1. “ro” becomes “rw init=/sysroot/bin/sh”
  5. Press Ctrl-X to boot with this configuration
    1. Note that this doesn’t save the configuration, just lets you boot into it for this Session
  6. Now you should have Root access, type the “passwd” command to change the password.
  7. Reboot the server and use your new password to login.

This method is great for 1&1’s Dedicated Servers using the Serial Console, 1&1’s Cloud Servers using either the KVM/VNC console, and Digitalocean’s KVM console. As long as you can see GRUB, you can change the root password.

March 28 2016

CentOS 6 | Root Password Reset (GRUB Method)

Imagine the situation where your Administrator is fired/quits, and with him takes the root password of the server and need access to the server right now. Fortunately, Linux makes the process incredibly easy since you have local access, at least in the eyes of the Linux OS. All this method requires is the ability to manipulate GRUB, so if you have a way of seeing the grub menu and working with it, then this method is for you.

Let’s get started:

  1. Boot to the grub menu
  2. At the Grub menu press ‘e’ for edit.
  3. You should see 3 lines, scroll to the kernel line
  4. Using the Right Arrow, scroll to the end of that line
  5. Type the number “1” at the end and then hit “Enter”
  6. Now you’re looking at the 3 line again, hit ‘B’ to boot with this configuration
    1. Note: This is not saving the configuration, just booting you into Single User Mode for this session.
  7. You should now be booted into Single User Mode with Root access. Change the password with the “passwd” command
    1. # passwd
  8. Reboot the server with the “reboot” command

This method is great for 1&1’s Dedicated Servers using the Serial Console, 1&1’s Cloud Servers using either the KVM/VNC console, and Digitalocean’s KVM console. As long as you can see GRUB, you can change the root password.