Color ls output and permission denied

In my post from earlier this week on removing the color output from the ls command I mentioned that in some circumstances the color-coded output can cause permissions errors. Cloned Milkmen asked that I explain why this would be.

I was hoping someone would ask that. In Linux and UNIX if the execute flag is not set on a directory, as in the example below, the ls --color=tty command will return Permission denied.

$ ls -ld ls_test/
dr-------- 4 jonemmons pg222211 4096 Nov 12 20:07 ls_test/
$ ls ----color=tty ls_test/
ls: ls_test/test1: Permission denied
ls: ls_test/test2: Permission denied
ls: ls_test/test3: Permission denied
dir1 dir2
$ ls ls_test/
dir1 dir2 test1 test2 test3

The execute flag is funny on directories. The main effect is that it will inhibit a user’s ability to cd into a directory, but it will also keep you from being able to get information out of the file’s inode (the inode contains information about when a file was created, modified, accessed etc.) Since ls requires information from the inode to properly color-code files in a directory it will fail if the execute bit is not set. An ls -l will fail for the same reason.

So thanks to Cloned Milkmen for asking the question. If you’re looking for some eclectic and distracting reading, check out his blog The Synthetic Librarian.

unix, linux, directory, permission, security, sysadmin, system administration

Oracle Shell Scripting Now Available!

Oracle Shell ScriptingExactly 15 months after I first posted about it my book Oracle Shell Scripting: Linux and UNIX Programming for Oracle has finally been printed and is available!

The book offers an introduction to shell scripting, an in-depth look at many useful shell commands and tools and a bunch of example scripts to use as-is or as a basis for your own custom scripts. As a long-time database and system administrator I have compiled some of the best tools, tips and tricks I have found for administration, monitoring and automation of DBA tasks.

I know you’re just dying to go out and get it, but it will probably take a couple weeks for it to hit book stores and Amazon. The best way to buy the book is directly from the publisher. They have it in stock and ready to go.

I will be posting more about the book here in the near future. It really covers a lot of what I have learned in my professional career and I’m thrilled at the opportunity to share my experience in this form. If you have questions about the book please feel free to leave a comment. I don’t always get to my comments quickly, but I do read and reply to all of them.

unix, oracle, shell scripting, linux, book, database tuning, database administration, database security

Get rid of color ‘ls’ output in Linux

Color ls outputMany popular varieties of Linux use a “feature” which causes the ls command output to show files, directories, links, etc. all in different colors. I guess some people prefer this, but I find it at best annoying, and at worst illegible. Specifically the color-coding of symbolic links tend to show in such a light color that it is often impossible to read.

The color output is accomplished by adding the --color=tty or a similar option to the ls command. This is typically accomplished by creating an alias to ls in either the user’s profile or in one of the system-wide profiles.

alias ls='ls --color=tty'

My personal preference is to remove this line from any system-wide configuration files (such as /etc/profile) and allow users to set it in their own profile if preferred. If you don’t have the desire or ability to make this change universally than a user can easily disable the color output by using the unalias command:

unalias ls

This can either be added to the user’s configuration file (e.g. the .profile or .bash_profile in their home directory), or you can just type unalias ls anytime to disable color ls output for the rest of the current shell session. This can be especially useful to turn off the color output when you’re working on someone else’s system.

Color-coded ls output can cause permissions errors in some circumstances, so in my opinion it is best left off, but if you’re stuck with it then it’s nice to know how it can be disabled when necessary.

ls, sysadmin, system administration, linux, shell, bash, sh, UNIX

Every IT worker needs a spelling alphabet

If you’re in IT or any other field where you have to say and spell things like URLs, user names or worst of all passwords over the phone you know how frustrating it can be when the person on the other end of the phone doesn’t quite understand the words and letters you’re saying! This problem stems from the tendency we have to use visual clues (lip reading) to interpret what we hear.

Despite the ubiquity of email and chat tools sometimes you have to do business over the phone (especially as passwords should never be sent via email.) Thankfully this problem was solved a long time ago by radio operators by using a common spelling alphabet.

The most popular spelling alphabet is the NATO phonetic alphabet (seen below) which uses familiar and easily distinguished words.

Letter Code Word Letter Code Word
A Alpha N November
B Bravo O Oscar
C Charlie P Papa
D Delta Q Quebec
E Echo R Romeo
F Foxtrot S Sierra
G Golf T Tango
H Hotel U Uniform
I India V Victor
J Juliet W Whiskey
K Kilo X X-ray
L Lima Y Yankee
M Mike Z Zulu

I’ve decided to keep a printed copy of this chart at my desk so I don’t have to worry about coming up with awkward words every time I need to spell out a password. If you want one too here’s my printable version.

alphabet, spelling, nato, passwords

You find it in the strangest places…

Humor me for a moment and read the following statements:

“If there are any competent Asians, I failed to meet them.”

Asian or Arab origin people are incompetent. My point is proved by the fact that they have always been slaves and will remain in such conditions. The west has always dominated the east.

I know what you’re thinking, there’s a lot of shit out there on the net, but would you believe that this racist garbage is tolerated on the forums of Oracle’s own website?

And if you think the statements above are bad (or you think I have somehow taken it out of context) you should read the whole thread. It’s amazing that (allegedly) educated professionals can be so ignorant.

More amazing to me is that Oracle doesn’t pursue and remove these posts. After all, for every person who will speak up against this racist crap there are ten who will just leave with a bad taste for the people who host the content.

oracle, racism, racist, prejudice