Generating puppet password hashes

Puppet needs user passwords in configuration files to be encrypted in the format the local system expects. For Linux and most unix-like system, that means, you have to put the sha1 sum of the password into the configuration file.

user { 'root':
ensure => 'present',
password => '$1$HTQx9U32$T6.lLkYxCp3F/nGc4DCYM/',

To generate the password use Python with:
python -c 'import crypt; print crypt.crypt("password", "$6$salt")'

Obviously don’t use password as your password!

Quickly change the date and time in Linux from the shell

Sometimes you may just need to get the date and time quickly set before going on and installing NTP or OpenNTP and configuring them with a NTP server. The following examples show how quickly you can set the date and time at the command shell in Linux.

How can I set the system date and time from the command prompt (bash shell)? I don’t have GUI installed and I am login over ssh session. How can I set date under Linux operating systems?

Type the date command:

 $ date 

Sample outputs:
Wed Apr 23 10:32:59 CDT [email protected]

Linux Set Date Command Example – Use the following syntax to set new data and time:

 date --set="STRING" 

For example, set new data to 2 Oct 2006 18:00:00, type the following command as root user:

 date -s "2 OCT 2006 18:00:00"
date --set="2 OCT 2006 18:00:00"

You can also simplify format using following syntax:

 date +%Y%m%d -s "20081128" 

Linux Set Time Examples:

To set the time to 15:47:

date +%T -s "15:47:00" 

To set the date and time to July 10 at 15:50:

 date 07101550 

To set the time and date including the year to July 10 2012 at 16:00 and 30 seconds:

 date -s "10 JUL 2012 16:00:30" 

For more info see the man pages in your distro with “man date” command.

Linux ethtool Examples to Manipulate Ethernet Card

ethtool is a utility for Linux kernel-based operating system for displaying and modifying some parameters of network interface controllers (NICs) and their device drivers. ethtool is developed parallel to the Linux kernel.

The command is useful for

  • Identification and diagnosis of Ethernet devices
  • Extended Ethernet devices statistics
  • Control speed, duplex, auto-negotiation and flow control for Ethernet devices
  • Control checksum offload and other hardware offload features
  • Control DMA ring sizes and interrupt moderation
  • Control receive queue selection for multiqueue devices
  • Upgrade firmware in flash memory


ethtool eth0
ethtool -s eth0 autoneg off
ethtool -s eth0 speed 10 autoneg off
ethtool -i eth0
ethtool -K eth0 tso off
ethtool -K eth0 tso on
ethtool -a eth0