Booting into Single User Mode – (Password Recovery)

Many occasions during commissioning of servers we need to reboot especially to freshen hardware re-configurations. (ain’t that still a bitch). Single user mode is there to help.

Booting into single user mode

  1. At the GRUB splash screen at boot time, press any key to enter the GRUB interactive menu.
  2. Select CentOS with the version of the kernel that you wish to boot and type ‘a' to append the line.
  3. Go to the end of the line and type single as a separate word (press the Spacebar and then type single). Press Enter to exit edit mode.
    You are in Single User mode.

Checking for email server blacklisting

Trying to understand why mail is not being sent ?

[For Sendmail]

If your  tail -f /var/log/maillog logs are showing something like this:

Aug 30 22:43:06 netman sendmail[8100]: starting daemon (8.14.4): SMTP+queueing@01:00:00
Aug 30 22:43:06 netman sm-msp-queue[8109]: starting daemon (8.14.4): queueing@01:00:00
Aug 30 22:43:11 netman sendmail[8102]: q7SIq1Kk011256: to=<david.saliba@jial.com>, ctladdr=<root@netman.lan> (0/0), delay=2+04:51:10, xdelay=00:00:05, mailer=esmtp, pri=3720580, relay=alt4.jial-smtp-in.l.gogglee.com. [XX.125.142.26], dsn=4.0.0, stat=Deferred: alt4.jial-smtp-in.l.googglee.com.: No route to host

Try telnet-ing to the IP  [XX.125.142.26] on port 25:

telnet XX.125.142.26 25

[root@netman ~]# telnet 74.125.142.27 25
Trying 74.125.142.27...
telnet: connect to address 74.125.142.27: No route to host
[root@netman ~]#

Check here to see if your server is blacklisted using this site:

http://www.mxtoolbox.com/blacklists.aspx

There all you need to do is enter your external IP address and see if that is the issue.

If not remember if you are using dynamically assigned IPs there is a good chance that’s the issue try relaying through another server.

 

Creating a router on a CentOS 6 server

Assuming you want to NAT the network on eth1 and route the traffic to eth0 this is the spell:

Create the forwarding rule:

/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

and then enable IP forwarding

 echo “1” > /proc/sys/net/ipv4/ip_forward

OR

sysctl -w net.ipv4.ip_forward=1

 

Permanent setting using /etc/sysctl.conf

If we want to make this configuration permanent the best way to do it is using the file/etc/sysctl.conf where we can add a line containing net.ipv4.ip_forward = 1

/etc/sysctl.conf: net.ipv4.ip_forward = 1

if you already have an entry net.ipv4.ip_forward with the value 0 you can change that 1.

To enable the changes made in sysctl.conf you will need to run the command:

sysctl -p /etc/sysctl.conf

On RedHat based systems this is also enabled when restarting the network service:

service network restart

 

Windows time stamping in batch files

Creating a time-stamp  in windows can be usful for the automated backups we all SHOULD be doing 🙂

 

pkzip c:\<source>\*.* c:\<target>\TempZip.zip
ren C:\<target>\TempZip.Zip c:\<target>\TempZip_%date:~-4,4%%date:~-7,2%%date:~-10,2%.zip

 

Or simply to create a directory for copying open files (Lawrence 🙂 )

set backdir=%date:~-4,4%%date:~-7,2%%date:~-10,2%

mkdir %backdir%

cd %backdir%

etc..

 

 

Allow remote SQL connection to Mysql from any host

Allowing the login of a user from any host in Mysql is simple:

mysql> select host, user from mysql.user;

+—————+——+
| host | user |
+—————+——+
| 127.0.0.1 | root |
| localhost | root |
| minimal01.lan | root |
+—————+——+
3 rows in set (0.00 sec)

mysql> update mysql.user set host=’%’ where host=’127.0.0.1′;

mysql> select host, user from mysql.user;

+—————+——+

| host | user |
+—————+——+
| % | root |
| localhost | root |
| minimal01.lan | root |
+—————+——+
3 rows in set (0.00 sec)

 

Voila`

 

CENTOS 6 Minimal does not have the Network interfaces up by default

So test drove CentOS  6 Minimum install ..

Only real hiccup till now is :

TUV ( the upstream vendor) aka RHEL decided to disable the network interfaces by default. WTF to that.

A glance at the FAQ  will show the solution :

Here’s my version for multiple interfaces.

 

# cd /etc/sysconfig/network-scripts/  

# sed -i -e ‘s@^ONBOOT=”no@ONBOOT=”yes@’ ifcfg-eth*

Enable grub menu UBUNTU

Enable grub menu:

edit the /etc/default/grub  file and change the

GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true

to

GRUB_HIDDEN_TIMEOUT=10
GRUB_HIDDEN_TIMEOUT_QUIET=false

Save and call:

sudo update-grub

from a terminal, and reboot.