Category Archives: IT management

I Like Good Linux Lists On The Morning

Lists are the magic word for SEO and link bait, and they catch the eye.

Well I sometimes bite too so here is the latest Linux links list I have fallen for:
15 Power tools for Linux that you cant afford to miss,
I havent checked all the links in the page yet, but I will.

And you should probably check out the whole blog,
It looks very promising and fun to read.
from their description:
Penguin Inside is a blog about Linux and Software Guides, How-TOs, Reviews.
The blog is dedicated to Linux Desktops.

Another Good list is from Smashing Magazine:
50 Beautiful Flash Websites , and thats a beutiful list of 50 stunning flash websites,
A couple that i liked the most are:

e-Content Solutions

econtent

and v5 Design

v5design_s

Technorati Tags: , , ,

Test http server from windows command line

curl for windows

So you went ahead and did a little change to your web site, or web server redirect,
and you want to test it out without a sniffer,
the fastest way to test the http server headers and output is from the command line so you can see exactly what the servers is sending.

Now from Linux you have built in tools like GET, and wget ad curl,
wget and curl you can also install on windows to work from the command line.

Curl For Windows

Go ahead and download curl from their main website, you should get the Win32 – General version,
or the Win64 binary.
Better take the SSL enabled version if you will ever need to test SSL.
Take the curl.exe file from the zip file and place it somewhere in your windows PATH.

To find which directories are already in the windows path open the command line and write:

C:\>echo %PATH%

You will get the listing for such directories, just place the curl.exe in one of them.

Now for the tests:
To get only the headers and not the file contents itself use “curl -I http://address”

C:\>curl -I http://some.site.com/blocked_folder/blocked.php
HTTP/1.0 403 Forbidden
Server: Apache
Accept-Ranges: bytes
Content-Type: text/html
Expires: Tue, 27 Oct 2009 19:32:38 GMT
Cache-Control: max-age=0, no-cache, no-store
Pragma: no-cache
Date: Tue, 27 Oct 2009 19:32:38 GMT
Connection: keep-alive

From this test you can see the file is forbidden, what are the caching setings for the server, and other headers information.

If you would like to see the full page contents just remove the “-I”.

another sample:

C:\>curl -I http://www.cisco.com/
HTTP/1.1 200 OK
Date: Tue, 27 Oct 2009 19:36:28 GMT
Server: Apache/2.2
Set-Cookie: CP_GUTC=62.214.121.218.123463458258569; path=/; expires=Sat, 21-Oct-34 19:36:28 GMT; domain=.cisco.com
Last-Modified: Tue, 27 Oct 2009 16:34:14 GMT
ETag: “5985”
Accept-Ranges: bytes
Content-Length: 22917
CDCHOST: cdcxweb-prod1-02
Content-Type: text/html

this time we got a 200 reply which means the apache sent us the page,
we can see the page’s size from the “Content-Length” header,
and the other info the apache wants to send us.

Testing for Virtual hosts

Virtual hosting on apache can mean having more domain names on the same IP,
and you can test each of these domains by adding a “Host” header to the curl test line:

curl -H “Host: sub1.host.com” http://www.hosting.com/
curl -H “Host: sub2.host.com” http://www.hosting.com/

These 2 lines will bring back the html code for each of the different virtual hosts on the same server.

Here are some more ideas of using curl -for example:
Sending POST data through curl

Technorati Tags: , , ,

How to Debug Samba Server and solve user connection problems

samba_linux

Samba is the server used to share files from a Linux server to the rest of the windows clients in an office,
it is  an easy to use server with simple defaults that will make the integration easy into any domain,
you can find on the samba main site some configurations samples and newer smb.conf samples to help ease the server into the domain.

But the harder part after setting the server is debugging problems with it,
like a user permission problem – can the user authenticate to the Microsoft domain server?
maybe he has a password problem? maybe he doesn’t have permission to access the share?

Setting up samba logging:

For starters you will find all the config files are at /etc/smb
the main config file is smb.conf,
other important files are smbusers and smbpasswd,
smbusers is a mapping file, to mask windows user as a linux user for access.

Now first thing to do when debugging is to setup the logging well,
so these are good log settings in the /etc/samba/smb.conf for debugging of the samba service:

log file = /var/log/samba/%m.log
syslog = 0
log level = 3 passdb:0 auth:0 winbind:0 vfs:0
vfs objects = full_audit

  • log file = /var/log/samba/%m.log                             the %m is substituted for the machine name.
  • syslog = 0                                                                             0 means only LOG_ERR will be sent to the syslog,
    If you want more info to be sent there change it to 3
  • log level = 3 passdb:0 auth:0 winbind:0 vfs:0        gives better control over which options to log
  • vfs objects = full_audit                                                  this allows for full details on which files are accessed by whom.

With this configuration all the machines log files will be found under /var/log/samba/*.log
for a sample, if you been trying to connect to the samba server from a machine named “boo1″
you should see in the log folder: /var/log/samba/boo1.log

You can search inside the folder by using “ls –latr” to find the newest files,
which will mean the windows clients that have been trying to connect to te samba server.

And “tail -100 machine_name.log” to view the errors you got if you couldn’t access the share.

Real life Debug sample:

from the file temp1.log:

nmbd/service.c:make_connection_snum(314)
user ‘temp1′ (from session setup) not permitted to access this share (share2)

This error means to that your user is known as temp1,
and temp1 doesn’t have permission to access the share “share2”
in which case you need to open the smb.conf and setup the permissions
for the user on this share to allow him access.

Inside smbusers you can map windows users to a specific unix user with this syntax:
unix_user = MY_DOMAIN\windows_user1 MY_DOMAIN\windows_user2 MY_DOMAIN\windows_user3

And then allow access to shares in the config by using the unix name:
valid users = unix_user

Checking access to the server and listing shares on it from commend line:

smbclient -L //server -U windows_user

You will be prompt for password, and if the settings are good, you will receive the shares listing from the server.

Connecting to a share on the server:
smbclient  //server/share -U windows_user

after answering the password you get a command line much like ftp:

smbclient //server/share -U builder
Password:
Domain=[MY_DOMAIN] OS=[Unix] Server=[Samba 3.0.33-3.7.el5_3.1]
smb: \>

mounting windows share on linux from fstab:

This will allow for automatic mount in case of server reboot:

\\server\share /unix_location  smbfs  credentials=/etc/samba.sharepasswd,uid=unix_user,gid=unix_group,ip=192.168.0.1,lfs 0 0

Contents of /etc/samba/.sharepasswd should be windows user and password to connect to the share:

username=windows_user

password=windows_pass

Getting info from a windows domain controller for samba debugging:

To list all the windows domain users from linux command line:

net rpc username -S icq-mdc1

replace “username” with a valid windows user name, to list all the users in the server,
you will need to know the user password as well.

This command can list the user groups from the domain controller:

net rpc user INFO username -S domain-server-name

replace “username” with a valid windows user name.

Technorati Tags: , ,

How to start learning Linux

If you want to start learning Linux the best advice I can give you is:

Start out as a user first

The simplest way is to download some live CD from the Internet,
for a sample this one:
Centos live CD
or: 
Fedora liveCD
Either of which will boot into a full working Linux distro,
without installing anything on your windows box.
when your done playing with the Linux server, just remove the CD from your computer, and reboot – your windows will come right back.
both the distros I’ve linked to here are very similar – they use the same redhat code, but the fedora is more cutting edge development version of everything and the centos is a stable server environment.
The fedora LiveCD will also allow you to install it to the machine your using from the LiveCD itself – after the boot you will see an install Icon on the Linux desktop.
Start playing with the servers, while reading some linux tutorials,
start as a Linux user and then work your way up to power user and to admin in the end.

Hands On Training Tasks for Linux Sysadmin

After your feel you know your way around as a user:

  • reading and writing files
  • working your way around the file system
  • installing some rpm packages

You can start working your way through some serious hands on training – try to do either of these:

  • Setup A stand alone DNS server
  • Setup Apache server with php and SSL
  • Install MySQL server from sources
  • Setup sendmail
  • Install WordPress or Joomla on your Apache/MySQL and happily see it all working together

Each of these tasks will take a long time to figure out for the first time, and on the way learning to do the task, you will learn a lot more things that you wouldn’t have just by playing with the server.

Technorati Tags: , , , , , , ,

nagios love – vote on SourceForge.net Community Choice Awards

nagios

SourceForge.net Community Choice Awards have opened up for voting,
now is your time to go and vote for your favorite Open Source applications,
Show the love for those Linux apps your have been using for free for so long :)

I’m voting for nagios in the “Best Tool or Utility for SysAdmins” Category,
and here is the direct link to vote for nagios.

But don’t stop there – other apps I’ve been lovingly using for the last years and I’m gonna give some voting love for are:

  • xampp  –  apache mysql php and perl on windows/linux
  • TortoiseSVN  –  SVN client for windows
  • Notepad++  –  The best simple text editor
  • Audacity  –  Sound editor
  • phpMyAdmin  –  Management system for MySQL Database
  • OpenOffice.org  –  MS office replacement
  • KeePass  —  Password manager

There where some hard choices to do there, since in the same categories I had more then one app that I’m totally depending on for day to day work.

phpMyAdmin changed the way I’m working with Mysql databases,
Notepad++ is my favorite editor on my windows box,
and with Audacity i make all my ring tones :)

what are your favorite Opensource apps?

Technorati Tags: , , ,

Linux Server Information – The Easy Way

cfg2htmlsml

In my last post I talked about listing your Linux server hardware information via command line tools,
but for the lazy Linux sysadmins there is a tool which will collect all your Linux server information for you in one swipe.

cfg2html tool

It will collect everything and sort it out, and will create a nice html for you to list everything you ever wanted to know about your Linux server.

it will list this info and much much more:

  • The Operation system installed and current status of it
  • reboots
  • memory consuming processes
  • uptime
  • services startup and runlevel
  • current and default runlevel
  • crontab listing
  • a lot of info about all the hardware installed
  • which packages are installed
  • Hard-disks information
  • LVM info
  • all the different network settings
  • Kernel modules and libraries
  • and a lot more.

simple cfg2html Installation:

download the package from the server:

cd /tmp
wget http://www.cfg2html.com/cfg2html-linux-1.60-20090415_all.zip
unzip cfg2html-linux-1.60-20090415_all.zip
rpm -ivh cfg2html-linux-1.60-1.noarch.rpm

if there is already an older version installed you can update it with:

rpm -ivh –freshen cfg2html-linux-1.60-1.noarch.rpm

edit the server details config text file:

vi /etc/cfg2html/systeminfo

and run the Linux server info gathering script:

cfg2html-linux

this will create a couple of files named after your computer name and a couple of images.
all you have left to do is open the server_name.html file with your favorite browser (eg. firefox) and that’s it – all your Linux server information is there to go through.

Technorati Tags: ,

installing wordpress on windows

installing wordpress on windows image

In my last post i talked about installing apache and mysql on windows for development needs, and now we can add to that install a wordpress blog.

when i do changes to the php code on wordpress i first test it on the local version of the them to make sure its good before going with it public.

1) get the wordpress files

first thing – download the wordpress install file from the website,
the default html folder for xampp is C:\xampp\htdocs so lets create a folder for our blog there: C:\xampp\htdocs\testblog and unzip the wordpress files into that location.

2) setup the MySQL user and database

go to http://localhost/phpmyadmin/index.php and choose the Privileges tab,
find the “Add a new User” link.
fill in a user name – anything you want, and a password.
in the “Database for user” section make sure to check: “Global privileges” press the “Check All” link to give the user all the privileges (this is something you should do only on a development server!!! )

press the Go button.

at this point its best to reload the privileges tab and use the “reload the privileges” link to make sure the user is loaded.

3) edit the wp-config.php file

go to C:\xampp\htdocs\testblog where all the blog files are located and rename wp-config-sample.php to wp-config.php, edit the file and setup:
edit the DB-NAME line and replace “putyourdbnamehere” with the username we created a minute ago,
replace “usernamehere” with the the same user name we just used,
“yourpasswordhere” should be replaced with the user’s password,
and also you have the “Authentication Unique Keys” part where you need to create keys for your blog,
you can use this wordpress.org page which will create the keys for you. copy and paste the keys to the config file.

4) run the wordpress config php

if you installed the wordpress files into “testblog” folder, the install file will be at: http://localhost/testblog/wp-admin/install.php

choose a blog title and an email, and you have your own development blog running.
don’t forget to change the admin password first thing…

you can access your new blog at: http://localhost/testblog/

from here now you can do all the changes and testing you want, including themes and plugins, before you upload them to your live blog.

Technorati Tags: , , , ,

13 books and magazines for linux sysadmins

This is a list of books and magazines i read through the years to learn my job,
there are many other good books as well, but these are my must haves.

1) Magazines:

linux format linux magazin

These two magazines I have been reading for years and they keep getting me fresh ideas and money savers for work,
they have some tutorials for beginners, some more heavy weight material, and fun projects for the free time (ach, whose kidding, what free time…).

although the info in them is usually a little out of date – they are published once a month and the industry is moving so fast, they do have a lot of good ideas in them, and it much more fun to snuggle with a color magazine then sit in front of the screen to read.

2) DNS:

DNS and BIND (5th Edition)

DNS and bind – every Linux sysadmin should know networking as well, and DNS is one of the pillars of the Internet,
even if you are not responsible to a DNS server, if you are working with anything related to the web or networking, you are using DNS, and knowing this subject good will help you solve many networking and web related problems.

3) Sys Admin handbooks:

linux_system unix_system

These are two books from the same authors, both are fantastic easy to use, in depth system administration books,
but you should buy just one out of the two since they very much a like.

so which one to buy? that depends on what flavors of unix/linux you need this info for:
UNIX System Administration Handbook (3rd Edition)
if you have many different unix servers at work you should get the unix book, it covers Solaris 2.7, HP-UX 11.00, Red Hat Linux 6.2, and FreeBSD 3.4.
a little out dated, but still very helpful as it will show you how to do the same thing in the different systems.

Linux Administration Handbook
on the other hand, if you have different linux versions running this book covers redhat, suse and debian – again showing you how to do the same thing in the different flavors.

4) PHP scripting

Different scripting languages are good for different things, PHP is good for building web interfaces for actions you wish your users to do without a shell account on your server.
php allows you to easily build forms and web pages to manipulate files on your server, and changing passwords, restore and backup files, etc…

php_cookbook programming_php

Programming PHP
Is the php book to start with, it takes you through the step of learning a new language and writing easy code.

PHP Cookbook
this php book will give you real world questions and answers for php coding – like how to open and read each word in a local or remote files, working with other web pages etc..

5) PERL scripting

PERL is faster to use when you want to do heavy weight work on databases or files and text manipulation and sorting.

Learning Perl, 5th Edition
The learning perl book will teach you perl from the beginning with real live samples and mind you – perl is tricky.

Programming Perl (3rd Edition)
this is a more in depth book for perl.

6) Bash shell

bash is the most popular shell for the linux environment, its strong and flexible and allows you to do many manipulations from the command line on files and texts, and its a great scripting tool to ease the work of a weary linux sysadmin (or lazy – its a great moto – always write something once).

Learning the bash Shell: Unix Shell Programming

and

bash Cookbook: Solutions and Examples for bash Users

as you can see by now, i really like the combination of a learning book and a cookbook 😉

7) security

hacking_linux_exposed
Hacking Exposed Linux, 3rd Edition

learning what your enemy knows will help you better understand where to look for security holes,
working in this job turns you slowly into a paranoid sysadmin if you wish to continue working, and this book will give you an insight into where likely holes in your servers will be and how to clear them.

8). IT management

practice_system
Practice of System and Network Administration, The (2nd Edition)

Never forget, your not only a linux sysadmin, you are also working in the IT environment and your decision and work is not just linux, you also need to consider network and the other servers and services around you.
this book is about the practice itself, not the technical stuff which we should all learn, and its based on the vast years of experience the authors have.
for example – how to build a support system – the people the software etc,
or how to structure your mail system so you will have place for growth when the company grows.

one of the best books I have read!!!

Technorati Tags: , , ,