Category: Commands

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

Veritas Volume Manager VxVM Basics Commands Cheats

Check out this article about Veritas Volume Manager VxVM Basics Commands Cheats. Please tell me what you think about it. You can contact me anytime!

Veritas Volume Manager VxVM Basics Commands Cheats.. The authority site for this topic, the VXVM on VXFS, if you do a Google search for any tutorial or command cheat sheet is Cuddletech.

I want to post… say, borrowing, the content of that page to this post for my own personal reference… Love your own page right? And since I am more likely to open SysadminPH that cuddletech, I thought we not copy the Veritas tutorial page here for my ease of access?

Continue reading »

SVM: Determine Free Space on Soft Partition

Check out this article about SVM: Determine Free Space on Soft Partition. Please tell me what you think about it. You can contact me anytime!

SVM: Determine Free Space on Soft Partition , we use the metastat -c command…

[root@localhost] /work/users> metastat -c d103
d103 p 32GB d100
d100 m 68GB d101 d102
d101 s 68GB c1t2d0s0
d102 s 68GB c1t3d0s0

[root@localhost] /work/users> metastat -p d103
d103 -p d100 -o 32 -b 58720256 -o 127926432 -b 8388608
d100 -m d101 d102 1
d101 1 1 c1t2d0s0
d102 1 1 c1t3d0s0

So from the first metastat -c d103.. that’s a mirrored 68G partition, d100 and a 32G soft partition d103.. We still have around 35G of space.

update: — someone comment please.. this information is incomplete!

Setting Search $PATH csh

Check out this article about Setting Search $PATH csh. Please tell me what you think about it. You can contact me anytime!

Another quikie copy/paste kind of thingy…

You may set your search path automatically each time you log in, by placing the appropriate “set path” command in your “.login” file.

(To learn more about the .login file, type “help dotlogin”.) Here is a sample of a command line that you might put in your .login file to set a non-standard search path:

set path = ( $path /usr/ucb /bin /usr/bin /usr/new .)

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!

 

Do Not Prompt Password for SUDO: NoPasswd

Check out this article about Do Not Prompt Password for SUDO: NoPasswd. Please tell me what you think about it. You can contact me anytime!

Do Not Prompt Password for SUDO: NoPasswd, here’s a quikie, quikie post… How do you setup a sudo for a user without prompting the user for his password?

RTFM! :)

Simply add NOPASSWD before the list of commands…again NOPASSWD goes before the list of commands, after your username and host list. The man page has this example:

ray rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm

Where ‘ray’ is the username, ‘rushmor’ is the host and the rest, you know already….

pwd – Most Used UNIX Command

Check out this article about pwd – Most Used UNIX Command. Please tell me what you think about it. You can contact me anytime!

pwd is probably the most widely used UNIX (or Unix-like) command! ls (el-es) could also be the most used but we will be talking about pwd here, so let’s say that ‘pwd’ is the most widely used shall we?

What is pwd?

pwd, when executed at the shell (prompt) will print out the current working directory in the standard output of the system, which is the monitor.

pwd could be and abbreviation for ‘print working directory’ or ‘present working directory’ or make up your own definition.. there’s no rule.

WIkipedia says:

In Unix-like and some other operating systems the pwd command (print working directory) is used to output the path of the current working directory.

The command is a shell builtin in certain Unix shells such as sh, and bash. It can be implemented easily with the POSIX C functions getcwd() and/or getwd().

The equivalent on DOS (COMMAND.COM) and Microsoft Windows (cmd.exe) is the “cd” command with no arguments. Windows PowerShell provides the equivalent “Get-Location” cmdlet with the standard aliases “gl” and “pwd”. The OpenVMS equivalent is “show default”.

Example:

$ pwd
/home/foobar

Replacing a Failed Disk in Solaris Mirror (SVM)

Check out this article about Replacing a Failed Disk in Solaris Mirror (SVM). Please tell me what you think about it. You can contact me anytime!

This one is about Solaris Volume Manager and all those meta commands you can think of.. (metadb, metadettach, metattach, metaclear etc)…

Yesterday we had to replace a failed disk that belongs to a mirror. The disk is running in a Sparc Solaris 10 box. It’s a 72GB from Fujitsu

c1t1d0           Soft Errors: 440 Hard Errors: 12 Transport Errors: 124
Vendor: FUJITSU  Product: MAY2073RCSUN72G  Revision: 0501 Serial No: 0711S0935R
Size: 73.40GB <73400057856 bytes>

As you can see from the iostat -En command, the disk is spitting hard errors and must be replaced before it can cause a lot more headache. It’s in c1t1, right.

Here’s what we’re supposed to do:

  • we could delete the meta data base that corresponds to the failed disk
  • detached the failed disk/slices to the mirror
  • clear it
  • unconfigure the disk
  • replace the disk
  • configure the disk
  • create new meta device database
  • Initialize the disk
  • Attached it to mirror
  • and sync

Here’s the detailed job:

Continue reading »

Restoring File From UFSdump Backup

Check out this article about Restoring File From UFSdump Backup. Please tell me what you think about it. You can contact me anytime!

Here’s what we did today on one of our Solaris box that is worth mentioning on this cool super system administrator’s blog ‘o mine! (Don’t you find it cool that SysAds are so funny?!)

Anyhoo, today we re-jumpstarted a laboratory box because the ‘owner’ of it wants it back. Since we pretty much messed it up, I have to jumpstarted a fresh copy.

After installing returned the original /etc/shadow and /etc/passwd back from backup (had a backup file on the laptop).. but unfortunately, the /etc/shadow file is ‘null’.

Restoring File From UFSdump Backup

Here’s the procedure in restoring a particular file from ufs dump backup… Of course if you’re restoring from ufs backup you probably made a ufs backup in the first place, right? Right!

In this example, the files backup.examples and junk are restored from the pubs directory:

Continue reading »