Category: Linux

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

Top equivalent for AIX – Topas, Only Better

Check out this article about Top equivalent for AIX – Topas, Only Better. Please tell me what you think about it. You can contact me anytime!

Top equivalent for AIX – Topas, Only Better… That’s what I searched when I got a ticket from one of the AIX boxes here complaining about CPU being 99% used up.

Of course, you can use vmstat with interval, but for those sysadmin folks who are use to using Top, its still more comfortable using (and seeing) the top output.

Topas is the equivalent of Top for AIX.. it’s better than Top as a matter of fact according to some AIX gurus (and Solaris)

If you persists in using top, You’ll have to build it yourself from the sources at http://www.unixtop.org/ plus probably this fix: 

        http://sourceforge.net/tracker/index.php?func=detail&aid=934590&group_id=72892&atid=536044

Good luck!

 

Searching For Fee Car Classifieds Script

Check out this article about Searching For Fee Car Classifieds Script. Please tell me what you think about it. You can contact me anytime!

Cars are no longer a luxury nowadays (except if you want to own a Ferrari or something). Cars are now a necessity in today’s standard of living. And let’s face it, with the price of brand new cars and the forever raising price of gasoline, not every one can buy a new set of wheels.

Thanks to websites that offer to sell (and buy) second hand, used cars many people can have places to search for and are no longer limited to the restrictions of locations.

I bought my first car (my only car for that matter) from a dealer that posted their inventory online. So, thanks to this second hand used car website, I was able to find myself and buy my very own car.

Continue reading »

Setting up an FTP server on Debian

Check out this article about Setting up an FTP server on Debian. Please tell me what you think about it. You can contact me anytime!

First things first, check to see what available ftp server are there for Debian

atp-cache search ftp-server

This will suppose to to list all available ftp server . As you can see there are a few available server you can choose. Popular one is proftp.

To install the service do:

apt-get install proftp

This will start installing .. you know, displaying all those letters and words and stuff..

webserver:~# apt-get install proftpd
Reading package lists… Done
Building dependency tree… Done
The following extra packages will be installed:
libmysqlclient15off libpq4 mysql-common perl perl-modules ucf
Suggested packages:
libterm-readline-gnu-perl libterm-readline-perl-perl proftpd-doc
Recommended packages:
perl-doc debconf-utils
The following NEW packages will be installed:
libmysqlclient15off libpq4 mysql-common perl perl-modules proftpd ucf
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 9623kB of archives.
After unpacking 39.1MB of additional disk space will be used.
Do you want to continue [Y/n]? Y

Run proftpd from inetd or standalone?

inetd
standalone

Initially selected standalone here.

And you’re done!

To start up the FTP service:

/etc/init.d/proftpd start

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

Trouble Installing Ubuntu on a NEO Laptop

Check out this article about Trouble Installing Ubuntu on a NEO Laptop. Please tell me what you think about it. You can contact me anytime!

I bought my very first laptop last week which comes pre-installed with Windows Vista Home Basic.

My original plan was to erase the whole thing and put Ubuntu on it. Tried it couple of days ago but didn’t work out.

After the boot up from the CD (requested a copy of Ubuntu 7.10) it displayed the little cross hair, then nothing…

I thought it’s probably the Vista… So I put in XP.. coz I tried installing Ubuntu over XP before, but the same thing happened!

So I wonder if this is a hardware issue on my laptop? It’s a NEO Empriva 540SVBe.

Will do a search later.

mysql: Multiple Table Query, Output into File

Check out this article about mysql: Multiple Table Query, Output into File. Please tell me what you think about it. You can contact me anytime!

Got a request from the boss today to extract all users plus their contact numbers from the Paging server

Server is a Red Hat Enterprise Linux AS release 4, running LAMP.

The data needed are located in several tables, so we need to query all relevant tables in the databse:

mysql> SELECT users.username, users.emailaddress, user_services.current_service FROM users, user_services WHERE users.username=user_services.username

The statement above queries two tables – users and user_services, as show from the expressin ‘FROM users, user_services’. The record in users table that information is required are in the username and emailaddress record. On user_services, it’s current_services. The WHERE sets the limit condition.

To send that output to a file, we use the INTO OUTFILE ‘</path/to/file>’.

So, that’s

mysql> SELECT users.username, users.emailaddress, user_services.current_service FROM users, user_services WHERE users.username=user_services.username INTO OUTFILE ‘/tmp/tempfile.txt’

AsteriskNOW – Asterisk Out Of The Box

Check out this article about AsteriskNOW – Asterisk Out Of The Box. Please tell me what you think about it. You can contact me anytime!

I recently found a nice read about a Linux Project or Distro that includes Asterisk. It contains all the Asterisk stuff one will ever need. The project is called AsteriskNOW.

You can donwload the package at asteriskNOW.com. You can choose to download and ISO image or a VMWare image on the donwload page.

The is so easy to use and install that AsteriskNOW claims that you can install it 30 minutes!

Continue reading »

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!

Less is More

Check out this article about Less is More. Please tell me what you think about it. You can contact me anytime!

In a Linux system (and in Solaris 5.8, 5.9, 10, Solaris in general apparently), there are two (identical? opposite?) commands that are very easy enough to remember. How is that? Well, first the command names speak for itself or do exactly what it is called. What are those commands? Well, they are:

more and and less.

more

The more command is a filter for paging through text one screenful at a time. For example if your viewing one large text file, you could use more to view the content of the file one screenfull at a time.

# more /path/to/file/filename

more also has an interactive mode that uses the commands based on vi. So if you’re viewing a file using more, it will pause on the first screenfull and just in case you would want to ’search’ for a particular string you could use the slash (‘/’) or the question mark (‘?’) just like you would if you’re using vi.

less

The command less, is just like more but unlike more which only goes one way, less allows backward movement in the file as well as forward movement.

Also, since more is a lot primitive than less, less also has tons of command line options. See it’s man pages for details.