How do you perform a deep file search for a string?

Frequently you are faced with having to perform a deep file search on a UNIX system, and you need to find all files that contain a certain text string in them.  You can perform the deep file search using either the find | xargs or find -exec construct.  I have found that the use of the find -exec worked much better then the former because of its ability to handle files with spaces. To perform a deep file search for a pattern, perform the following:

find . -follow -exec grep -l OpenSSH {} \;

This command will search the current working directory and all subdirectories, and will search for any file names that contain the pattern OpenSSH.  The command will also follow symbolic links since it uses the -follow flag.  The output will only list the file names that contain the pattern, it will not display the text itself.  This is done by the grep -l command and flag.

How to change Oracle user passwords?

To change a password for an Oracle database user, simply open a SQL*Plus session to the database as the user. If you are changing your own password, you can type the following in the SQL*Plus session:

password

To change other user accounts that are configured in Oracle, simply type the following command:

ALTER USER readonly_user IDENTIFIED BY 'new_password';

You can do change other database user account passwords if you login with a super user account such as SYS or some other super user account.

How do I change my password in Sybase database?

Assuming you know your own password, login to the Sybase database using the isql interface and type the following:

sp_password caller_password, new_password
go

If you have been granted additional database privileges or are a database super-user account, then you may change other account passwords by slightly altering the command to:

sp_password caller_password, new_password [, account_name ]
go

Where:

caller_passwd

is your password. When you are changing your own password, this is your old password. When a System Security Officer is using sp_password to change another user’s password, caller_passwd is the System Security Officer’s password.

new_passwd

is the new password for the user, or for loginame. Configure the minimum password length with sp_configure minimum password length. The default is 6 bytes. Enclose passwords that include characters besides A-Z, a-z, or 0-9 in quotation marks. Also enclose passwords that begin with 0-9 in quotes.

loginame

the login name of the user whose account password is being changed by the System Security Officer.

When you install Sybase the first time, the password for the sa user is set to NULL.  So, to set sa's initial password:

sp_password null, 'newPassw0rd'
go 

How to create a new file system on Solaris?

When creating a new file system on a newly formatted disk, all you have to do is create the new filesystem and then mount it.  To make it permanent on Solaris, you should make an entry in the /etc/vfstab.

newfs /dev/rdsk/c1t1d0s0

Once that is done, you can mount the new filesystem.

mount /dev/dsk/c1t1d0s0 /export/opt

Then add the following to the /etc/vfstab file:

/dev/dsk/c1t1d0s0    /dev/rdsk/c1t1d0s0     /export/opt    ufs     1    yes    -

How do you create virtual interfaces on Solaris?

Suppose you have a Solaris system with one physical interface and you have the need to create more logical or virtual interfaces for the purposes of running multiple SSL-based web servers.  In this example, suppose we have a single interface configured on bge0 with the IP address of 192.168.1.10 with a netmask of 255.255.255.0 and a default gateway of 192.168.1.1.  We want to create three (3) more logical interfaces that reside on this same subnet starting at .11. All we have to do is the following:

ifconfig bge0:1 plumb
ifconfig bge0:2 plumb
ifconfig bge0:3 plumb

Once the interfaces are plumbed, we add the IP and bring up the interface.  We do this by:

ifconfig bge0:1 192.168.1.11 up
ifconfig bge0:2 192.168.1.12 up
ifconfig bge0:3 192.168.1.13 up

To make our change permanent, we need to create the following three files:

/etc/hostname.bge0:1
/etc/hostname.bge0:2
/etc/hostname.bge0:3

And populate these files with a distinguishing hostname that is unique to each.  You could add myhost-1, myhost-2, myhost-3 for example.  Additionally, you will need to make separate entries for each ip/host in your /etc/hosts file.  Then reboot and run the following to ensure that the interfaces remained configured on a permanent basis:

ifconfig -a

How to upgrade Fedora with Yum?

When upgrading from Fedora 8 to Fedora 9 this is the sequence of steps taken to upgrade the OS using yum:

  1. yum install yum-fastestmirror
  2. yum clean all
  3. rpm -Uhv ftp://download.fedora.redhat.com/pub/fedora/linux/releases/9/Everything/i386/os/Packages/fedora-release-*.noarch.rpm
  4. telinit 3
  5. yum upgrade

That's all that plus following on-screen directions was all that was required.