Monthly Archives: February 2012

How to remove comments of a file and see

sed -e ‘/^[ \t]*#/d’ -e ‘/^$/d’ file.conf | more The first RegEx script deletes any line that starts with zero or more number of space or tab followed by a #. The empty lines are deleted in the next script … Continue reading

Posted in Uncategorized | Leave a comment

UNIX: Little tricks that can save your day

How to make PuTTY/ssh session available while restarting network or sshd daemon: _ () { sleep 2; service sshd restart; }; _ & ; disown $! How to find files with SUID bit set: find / -perm -4000 How to … Continue reading

Posted in Uncategorized | Leave a comment

Solving practical problem using POSIX Access Control Lists: FreeBSD/HP-UX/Linux/Solaris-UFS

Following steps should work on systems which follow POSIX ACL format (most of the UNIX variants do follow that with an exception AIX) How to share file/folders among a group of users: Turn the sticky bit (SGID) on at the … Continue reading

Posted in Uncategorized | Leave a comment

UNIX:Solaris: How to configure an NIC

Configuring an NIC on a Solaris 10 or 11 box is not as easy as doing the same on a RHEL box. I have a 7 step formula for basic setup of an NIC: 1. dladm show-phys – to check … Continue reading

Posted in Uncategorized | Leave a comment

RHEL:Solaris: How to use RHEL as an iSCSI target and Solaris as iSCSI initiator

Just thought it would be fun to use a low-footprint Linux (RHEL) machine as an iSCSI target and make use of Solaris’ ZFS filesystem that could be corporate class storage solution. On the RHEL (IP:10.0.1.102) machine, I did this: Installed … Continue reading

Posted in Uncategorized | Leave a comment

Linux:RHEL: Sharing with NFS

  1. Install nfs-utils package yum install nfs-utils C 2. Check the below two selinux Boolean are set to on: # getsebool -a | grep nfs allow_ftpd_use_nfs –> off allow_nfsd_anon_write –> off cobbler_use_nfs –> off git_system_use_nfs –> off httpd_use_nfs –> off nfs_export_all_ro … Continue reading

Posted in Uncategorized | Leave a comment

Linux: How to restore a deleted file which is still being used by a program

This is particularly useful when you accidentally delete a file which is still being used by a running program.  [unixuser@testserv-sl6 ~]$ ls -l total 108 -rw-r–r–. 1 unixuser unixuser 29113 Sep 25 04:16 accounting.info -rwxrw-r–. 1 unixuser unixuser   159 Sep … Continue reading

Posted in Uncategorized | Leave a comment

Linux:RHEL: Bits and pieces about SELinux

How to change a SELinux context for a user: We can check the available contexts by issuing the following command: eemanage user –l Check the security context of the user by issuing the following command: semanage login –l | grep … Continue reading

Posted in Uncategorized | Leave a comment

Linux: RHEL: How to resize a LUKS encrypted file-system while it’s online

First, we need to extend the size of the block device. In most of the cases, it would be a logical volume. We will extend the logical volume size: lvextend –l 100%VG /dev/luks_vg/luks_lv Now, we need to extend the LUKS … Continue reading

Posted in Uncategorized | Leave a comment

Linux: RHEL: How to create LUKS encrypted file-system

LUKS encrypted filesystem can be created over any of the block devices like a bare hard disk, logical volume, or a raid array. To create a LUKS encrypted file-system, we first need to write the block device with random data. … Continue reading

Posted in Uncategorized | Leave a comment