Command Example for useradd

The useradd command is a tool that provides sysadmins with the capability of adding new users (a.k.a. logins) to the system. The generic form of the command is this:

useradd -c 'COMMENT' -d 'HOME' -m -p 'CRYPT_STRING' -s 'SHELL' LOGIN
  • COMMENT is used generally for user information such as full name, phone number etc.
  • HOME is the home folder e.g. /home/user.
  • CRYPT_STRING string generated by the crypt(3) function (libcrypt, a component of glibc, the GNU C Library).
  • SHELL is the default shell for the user.
  • LOGIN is for the new username in question.

The -m option creates the user’s home directory if it does not exist.

Example:

useradd -c 'John Doe' -d /home/johndoe -m -p 'ABiELdbxGY2fY' -s '/bin/ksh' johndoe

John Doe just got himself a new account with the /home/johndoe home/login directory, created (-m) if not present, with CRYPT_STRING ‘ABiELdbxGY2fY’ generated by the crypt(3) function for the (simplest and unbelievably most commonly used) password ’123456′ with salt ‘AB’. The default login shell for this account is ksh (-s ‘/bin/ksh’). And last, the username, johndoe.

Go on and create some users on your grid.

Add CDROM or ISO Packages to Red Hat Enterprise Linux 5.7

Red Hat generally provides a stable Linux distribution in its currently supported releases. And one might want to only use the packages that came along with the distribution media i.e. a cdrom or an .iso file containing that cd’s image.

To be able to use a CD’s or .iso file’s packages in RHEL (Red Hat Enterprise Linux) 5.7, create this file in /etc/yum.repos.d/:

[user@localhost yum.repos.d]$ cat redhat_cdrom.repo
[redhat_cdrom]
name=Red Hat Enterprise Linux $releasever - CD-ROM
baseurl=file:///media/rhel/Server
enabled=1
gpgcheck=1
gpgkey=file:///media/rhel/RPM-GPG-KEY-redhat-release

This is assuming you had mounted the cdrom or the distribution’s .iso file to the /media/rhel directory.

Then do:

# yum update

And then pick up the desired software and install it:

# yum install <packages>

That is all.

Linux Look-and-feel on Windows with Cygwin

Want to have GNU/Linux utilities at hand on a Windows box? Suffer no more. Cygwin brings you that along with its several packages (GNU etc.) bringing recompiled versions of these for Windows.

Just to name a few out-of-the-box packages:

  • Interpreters: bash 4.x, ksh, zsh etc.
  • Servers: Apache web server, PostgreSQL, sqlite3
  • Scripting languages: Perl, Python, Ruby etc.
  • Utilities: cron, md5deep etc.
  • Version control: bzr (bazaar), git, subversion etc.

Remember: this is just to name a few! There are a myriad of packages for you to choose from.

Having bash 4 available is priceless. Do your normal shell scripting tranquile in Windows!

Also, one of the main attractions in terms of usefulness that Cygwin brings us is the mintty terminal emulator (intended for use with Cygwin on Windows). It has several awesome features like:

  • It is fast!
  • Making the user able to customize the colors, font and cursor type.
  • Control the behavior for the backspace key (^H etc.).
  • Command line options to hold execution (-h option) after execution of any command (-c command, as stated in mintty tips on google code), and also controlling the initial state of the window for when you create a shortcut for it (option -w max makes it start maximized).
  • Handling the copying with left mouse button selection well and preventing bad situations regarding line wrapping while doing so. ctrl + insert and shift + insert for copy and paste (respectively) are accepted as well.
  • Scroll with shift + {arrow|pgdn|pgup} .
  • Toggle on / off many of the program’s functions.
  • Window transparency.

Comparing mintty to the default terminal emulator in cygwin one can conclude that the former is a very significant improvement. For more, check this great article on mintty and also this one at howtogeek.com (more complete).

Try cygwin if you still had not and let us know of your explorations! Happy scripting!

nginx 1.0.7 and 1.0.8 release

For those that did not get acquainted with it, still, this is an excelent alternative to the Apache web server. It’s lighter and faster and modules such as php and passenger (ruby) are very well supported.

There’s been a week since the stable releases 1.0.7 and 1.0.8 were released. While 1.0.7 introduces lots of changes, 1.0.8 is just a bugfix for the build process with mp4 support. Check the release notes.

PSN security fail

Spafford who assisted in the investigation informed in a summary that they had an old Apache, no updates, exposed to the Internet even without a firewall, something that is very basic!

“In congressional testimony this morning, Dr. Gene Spafford of Purdue University said that Sony was using outdated software on its servers — and knew about it months in advance of the recent security breaches that allowed hackers to get private information from over 100 million user accounts.”

Check it out on this article: http://consumerist.com/2011/05/security-expert-sony-knew-its-software-was-obsolete-months-before-psn-breach.html