Category: Unix

KSH Script Basics | Special Shell Variables

Check out this article about KSH Script Basics | Special Shell Variables. Please tell me what you think about it. You can contact me anytime!

Just deleted tons of stale, unsused user accounts. Here are some KSH shell basics and special shell variable. I need to Google them up myself to get reminded that ‘$?’ is the output variable for script execution. That is, it’s 0 for successful execution and 1 if there is any error.

Continue reading »

getfacl and setfacl – Unix Access Control (acl) Tool

Check out this article about getfacl and setfacl – Unix Access Control (acl) Tool. Please tell me what you think about it. You can contact me anytime!

Today’s topic is all about Access List… For Unix and Unix-like system, the usual command to set the file permission is the ‘chmod’ command. However there are instances that we need more flexibility in giving access and control for files and folders. Get it? Access and Control? In this situation, there is a file utility built in Unix called ‘getfacl‘ and ‘setfacl‘.


getfacl
is a file utility for viewing the access control list information associated with a file or directory.

For a memory aid, you can think of ‘getfacl’ as “Get File ACL“.. ACL being Access Control List.

Access control lists are extended attributes added to most major file systems in the 2.6 kernel to improve ability to control the access of files. They allow permissions to be set for individual groups and users and not just the owning user, owning group, and all other users.

setfacl is a command that allows you to set the Access Control List information for a file or directory.

Access control lists are extended attributes added to most major file systems in the 2.6 kernel to improve ability to control the access of files. They allow permissions to be set for individual groups and users and not just the owning user, owning group, and all other users.

You can read man pages for both getfacl and setfacl for more information.

getfacl and setfacl example….

Here’s an example of using the basic funtion of getfacl and setfacl

# getfacl

#setfacl

setfacl -m default:user::rwx,default:group::r-x,default:other:r-x,default:mask:rwx /u06/OneSource/datapump_dbdump

setfacl -m default:user:rcodapp1:r-x,default:group:r-x,default:other:—,default:mas:rwx /u06/OneSouce/datapump_dbdump

Unlock locked user account in HP-UX

Check out this article about Unlock locked user account in HP-UX. Please tell me what you think about it. You can contact me anytime!

I know nothing about HP UX (yeah, except SAM). That’s why, just now, when there’s a request to just make a trace route from an HPUX server to another server, I have to login and do execute the command. I couldn’t log in as my user id so i logged in as root instead from the console.

I check grep’d my account the walah! It was there! I reset the password, open an ssh terminal and tried to login. unsuccessful, that’s why i knew then that it is locked.

Here’s how to unlock a locked user account in HP UX in command line.

In HP-UX 11.xx if user account is locked, you can unlock the account by running SAM. But running SAM takes some time usually 2-3 minutes on heavily loaded HP-UX servers. You can unlock the locked user account from command line by running following command:

1. Login as root or use sudo from your account, if there is no sudo installed just use su – root :

$sudo su –

*******

2. Run this command to unlock the locked HP-UX user account:

#/usr/lbin/modprpw –l –k johnm

Running modprpw will unlock the locked user account in HP-UX from command line.without running SAM

NOTE: modprpw is HP-UX command only and wouldn’t work in Solaris,AIX and any Linux servers

That info was ‘borrowed’ from here…. thanks!

Send Break on SPARC Enterprise T5120 – Send Break on ILOM

Check out this article about Send Break on SPARC Enterprise T5120 – Send Break on ILOM. Please tell me what you think about it. You can contact me anytime!

Send Break on SPARC Enterprise T5120 – well it for the T5000 series I guess, the newer ones. Or “Sending Break onan ILOM..

“->” = ILOM
“sc>” = ALOM

.. and since this particular server has the “->” prompt we’re using the ILOM.

From ILOM to Solaris:
-> start /SP/console

From ALOM to Solaris:
sc> console

And of course.. Enter “#.” to return to ALOM / ILOM !!

Send Break on ILOM

set /HOST send_break_action=break
and then
start /SP/console

c)ontinue, s)ync, r)eset? s

bada bing! bada boom!

Configure Virtual Hosting in Apache Web Server

Check out this article about Configure Virtual Hosting in Apache Web Server. Please tell me what you think about it. You can contact me anytime!

When we say or mention the word Web Server, the first thing that comes to our mind is Apache, right? (if you don’t then what are you doing here reading this? :-) )

Apache is the most well known open source web server there is! Open source?? Make that the most wildly used webserver on the internet, period!

It is believed (and i know they made a survey or study about it) that Apache takes 90% of all web servers in the internet. Most web hosting company, and I’ve once worked in one, use Apache.

This post will talk about how to setup Apache for Virtual Hosting

Continue reading »

All About Arlo Gilbert

Check out this article about All About Arlo Gilbert. Please tell me what you think about it. You can contact me anytime!

Who in heaven is Arlo Gilbert? Yep, using ‘heaven’ is perfect for describing this man for he do sometimes tries to conquer heaven. He’s into planes you see. :)

Anyway, you’re probably Googling about Arlo Gilbert as you read this post. Well, let me save you a few minutes and introduce you to Mr. Gilbert in one fast minute.

He is the following:

  • The Man is from Austin, Texas
  • Arlo Gilbert is a high school drop out… and a proud one (don’t do that boys and girls)
  • A family man! So there’s a Mrs. Gilbert and two little Arlo Gilberts (daughters)

The reason why we feature this brilliant man is that he has successfully launched online startups and been doing it for 10 years now. Remember, high school dropout and no training in marketing or any business related studies… Brilliant indeed.

What caught my attention while reading his ‘About’ page was his current project – the iCall. It’s a VOIP startup company. I was wondering if iCall was developed by Arlo Gilbert or if it uses Asterisk?

.

.

.

Tekken Philippines

vi Search and Replace… The Basics, Dummy’s Reference

Check out this article about vi Search and Replace… The Basics, Dummy’s Reference. Please tell me what you think about it. You can contact me anytime!

Yep, this is a dummy’s reference… I keep on forgetting the syntax so I might as well put it here for my own reference… :D

vi is the one, if not the most popular text editor available for a System Administrator on a UNIX and UNIX-like machines.

It has two modes, command and editor mode.

Here are some syntax in using the Search and Replace in ‘vi’.

Search:

The most basic and most easily remembered command for searching is vi is slash or ‘/’ followed by the character being searched. That’s for forward searching. For backward, vi use ‘?’ followed by the string being searched.

To go to the next occurrance of the string being searched, vi use ‘n’ command. Doesn’t matter if your searching forward (from up, down) or backward, from down to top.

Example:

(you have to be in command mode… press ESC first)

/search_string

?search_string

Search and Replace

For search and replace, use the syntax

:%s/original/replaced/g

Make sense?
Any command that begins with a “:” is called a line mode command and performs its duty on the line the cursor is currently on.

The above syntax serves my purpose now… If I want to replace text in certain ranges.. syntax can be found here

About the /proc and -xdev parameter for ‘find’

Check out this article about About the /proc and -xdev parameter for ‘find’. Please tell me what you think about it. You can contact me anytime!

/proc is a pseudo-filesystem used to access process information from the kernel. It doesn’t use any storage space and uses little memory. On Linux, you can sometimes make modifications to the running kernel by modifying “files” in /proc.

If / is full, run a command similar to the following to sort all files in the / file system by size:

find / -xdev -ls | sort -n -k 7

“-xdev” limits the find command to the root file system.

This will only look for files found in the root and will not includes those partitions that are defined in /etc/vfstab | /etc/fstab file, those listed when `df -k` is executed:

/dev/md/dsk/d0 2058319 1016097 980473 51% /
/dev/md/dsk/d3 2058319 1801793 194777 91% /var
etc .. etc..

Thanks Brandon!

Brandon H. – Senior UNIX Systems Engineer for an application services provider in Minneapolis, MN.

Difference Between NFS, DNS, NIS+, and NIS

Check out this article about Difference Between NFS, DNS, NIS+, and NIS. Please tell me what you think about it. You can contact me anytime!

NFS, DNS, NIS and NIS+… that’s a lot of acronyms!

Network File System

NFS is Sun’s Networked File System, and by now, more or less, the de facto method of sharing file systems between computers.

Domain Name Service

DNS is the Domain Name Service, which is the way information about hostnames and addresses are shared across the Intenet.

Network Information (Name) Service

NIS stands for Network Information Name Service. It was original called Yellow Pages, which is why many of the commands for NIS start with yp (such as ypbind, ypcat, etc.) NIS was developed by Sun, and is, like NFS, more or less the default way of sharing system information between UNIX machines.

NIS+

NIS+ is Sun’s re-implementation of NIS. It attempts to address some of the problems with NIS, but the implementers of NIS+ have made a series of bad choices in the design of NIS+, so it has seen only limited usage compared to the other types of services you asked about.

UNIX Quick Tip: Changing The Time Stamp Of A File

Check out this article about UNIX Quick Tip: Changing The Time Stamp Of A File. Please tell me what you think about it. You can contact me anytime!

This tip is a give away. Everyone knows this, but for those who doesn’t or forgot…  here’s refresher…

Here’s a typical output of a file listing using `ls -l` on a directory:

[root@unix-box icons]# ls -l | more
total 636
-rw-r–r–    1 elizar root          246 Aug 26  2005 a.gif
-rw-r–r–    1 elizar root          242 Aug 26  2005 alert.black.gif
-rw-r–r–    1 elizar root          279 Aug 26  2005 alert.black.png
-rw-r–r–    1 elizar root          247 Aug 26  2005 alert.red.gif
-rw-r–r–    1 elizar root          298 Aug 26  2005 alert.red.png
-rw-r–r–    1 elizar root         2326 Aug 26  2005 apache_pb.gif
-rw-r–r–    1 elizar root         1385 Aug 26  2005 apache_pb.png
-rw-r–r–    1 elizar root          293 Aug 26  2005 a.png

When using the -l (dash ‘el’) option of ls, the output will display a more detailed listing of the files. Here you’ll see the file properties/permission (-rw-r–r–) the number of links, the owner of the file, the group of the user, file size, the date/time stamp and finally the file name. That’s 7 column.

Changing The Time Stamp Of A File

To change the time stamp of a file (the 6th column in the `ls -l` listing), we use the UNIX command touch.

From the Man Pag:

NAME
touch – change file timestamps

SYNOPSIS
touch [OPTION]… FILE…
touch [-acm] MMDDhhmm[YY] FILE… (obsolescent)

There are many options for the touch command, but the one I use fairly often is the -t option

       -t STAMP;    use [[CC]YY]MMDDhhmm[.ss]

Example:

 [root@unix-box icons]#  touch -t 200607161201 a.gif
[root@unix-box icons]# ls -l | more
total 636
-rw-r–r–    1 elizar root          246 Jul 16  2006 a.gif
-rw-r–r–    1 elizar root          242 Aug 26  2005 alert.black.gif

Other options that you  may find useful are -a (change access time only) -m (modification time only) and others. Consult the man page for more details

Cheers!