Skip Authorization on MySQL DB

To skip authorizations and login without password to MySql server,

  1. sudo vi /etc/mysql/my.cnf
  2. Add the line skip-grant-tables after the linewhich reads skip-external-locking.
    1. Optionally comment the line bind-address = 127.0.0.1 if the db has to be accessed from external devices via TCP.
  3. Save and quit vim.
  4. restart mysql server ( sudo /etc/init.d/mysql restart in ubuntu)

Activate password authentication on Ubuntu VMs on Amazon EC2

ssh -i [path to private-key-file] [target IP]

# In the host shell

sudo adduser [username]     # Add a new user; this command also prompts for setting the password

sudo adduser admin            # Add this user to the admin group (to sudoers)

sudo vi /etc/ssh/sshd_config

# In the above file set "PasswordAuthentication" to "yes".

sudo reload ssh

The VM should now be ready for password based ssh authentication.

Temporarily enable SSH password authentication on RHEL/Centos VMs.

To enable password based authentication on RHEL/Centos machines, login as root to the target host. ( sudo the commands below if you are not logging in as root)

1. Create the password authenticated user if not already created –

  • On console run : adduser [username]
  • Set a password for the new user: passwd [username]

2. Add the user to sudoers and enable remote login –

  • On console run: visudo
  • In the file opened for editing, comment out the line – “Defaults    requiretty“
  • Add the line “[username] ALL=(ALL)       ALL”  below the line “root ALL=(ALL)       ALL“

3. Enable password authentication for SSH.

  • vi /etc/ssh/sshd_config
  • Replace the line “PasswordAuthentication no” with “PasswordAuthentication yes“. (Uncomment this line if commented.) Save and close this file.
  • /etc/init.d/sshd reload

4. To disable password authentication after use, in the above file replace “PasswordAuthentication yes” with “PasswordAuthentication no“; reload sshd as before.

Fix Vim editor on Ubuntu

Problem: The arrow keys insert characters, no status message at the bottom etc.

Reason : The default Vim on Ubuntu is vim-tiny, a skeleton version.

Fix: Install the real stuff – sudo apt-get install vim

Note: vi = Visual, vim = Visual improved. And vim-tiny is vi compatible, kind of Jurassic.