Showing posts with label Solaris. Show all posts
Showing posts with label Solaris. Show all posts

Friday, 12 September 2014

prstat -Z

If you have a Solaris server split up into zones, you can log on to the global zone and use prstat –Z. This produces a report like the one below. The last few lines show how much memory and CPU is being used by each zone. As usual, click on the image, if necessary, to enlarge it and bring it into focus:


Thursday, 16 January 2014

Password in History List

I logged on to a Solaris server as user oracle and was prompted to change its password. I was in a hurry so I tried to reuse the old password. This failed so I had to use a new one:
 
Password:
Warning: Your password has expired, please change it now.
 
New Password:
sshd-kbdint: Password in history list.
 
New Password:
Re-enter new Password:
sshd-kbdint: password successfully changed for oracle
 
We store our passwords in a spreadsheet which can only be accessed by certain people. A colleague had locked this and gone home so I could not update it with the new password. I tried to reinstate the old password from within the UNIX session but failed again for a different reason:
 
Solaris:oracle passwd
passwd: Changing password for oracle
Enter existing login password:
passwd: Sorry: less than 7 days since the last change.
Permission denied
Solaris:oracle
 
I logged on as root and this time I was able to reuse the old oracle user password:
 
Solaris:root passwd oracle
New Password:
Re-enter new Password:
passwd: password successfully changed for oracle
Solaris:root

Tuesday, 5 February 2013

UNIX compress Command

You can use the UNIX compress command to make a file smaller. Here is a worked example. I started by making a file called directory_list. I copied this file into another file called directory_list_save for future reference. Then I compressed the file called directory_list. This made the file much smaller and gave it a suffix of .Z. Finally, I compared the sizes of directory_list_save and directory_list.Z:

Tru64:/usr/users/oracle/andrew > ls -R $ORACLE_HOME > directory_list
Tru64:/usr/users/oracle/andrew > cp directory_list directory_list_save
Tru64:/usr/users/oracle/andrew > ls -l directory_list*
-rw-r--r--   1 oracle   dba      1971685 Feb  5 14:43 directory_list
-rw-r--r--   1 oracle   dba      1971685 Feb  5 14:43 directory_list_save
Tru64:/usr/users/oracle/andrew > compress directory_list
Tru64:/usr/users/oracle/andrew > ls -l directory_list*
-rw-r--r--   1 oracle   dba       558245 Feb  5 14:43 directory_list.Z
-rw-r--r--   1 oracle   dba      1971685 Feb  5 14:43 directory_list_save
Tru64:/usr/users/oracle/andrew >

You cannot read a file once you have compressed it as it is then in a different format. The purpose of compressing a file is to make it smaller so that it is easier to store or to send to somewhere else.  I created the file on a Tru64 machine then decided to send it to a Solaris machine using scp.
 
Tru64:/usr/users/oracle/andrew > scp directory_list.Z \
> zge-mktred-ddb1:/export/home/oracle/andrew
The authenticity of host 'zge-mktred-ddb1 (10.80.1.116)' can't be established.
RSA key fingerprint is d6:59:ba:8d:c6:24:21:1b:91:c2:3b:c5:5a:5b:8c:f9.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'zge-mktred-ddb1,10.80.1.116' (RSA) to the list of known hosts.
Password:
directory_list.Z                                                                                                           100%  545KB 545.2KB/s   00:00
Tru64:/usr/users/oracle/andrew >

I read somewhere that you could compress a file on one platform and uncompress it on another. So, once it was on the Solaris machine, I uncompressed it. This proved that a file compressed on Tru64 could be uncompressed on Solaris. Notice how this removed the .Z suffix from the file name. Finally, I compressed the file again on the Solaris machine:
 
Solaris:/export/home/oracle/andrew > ls -l directory_list*
-rw-r--r--   1 oracle   dba       558245 Feb  5 14:49 directory_list.Z
Solaris:/export/home/oracle/andrew > uncompress directory_list.Z
Solaris:/export/home/oracle/andrew > ls -l directory_list*
-rw-r--r--   1 oracle   dba      1971685 Feb  5 14:49 directory_list
Solaris:/export/home/oracle/andrew > compress directory_list
Solaris:/export/home/oracle/andrew > ls -l directory_list*
-rw-r--r--   1 oracle   dba       558245 Feb  5 14:49 directory_list.Z
Solaris:/export/home/oracle/andrew >

Then I sent the compressed file back to the Tru64 machine:

Solaris:/export/home/oracle/andrew > scp directory_list.Z \
> sredsvr8:/usr/users/oracle/andrew
The authenticity of host 'sredsvr8 (10.80.1.32)' can't be established.
DSA key fingerprint is 10:c8:14:df:7a:bb:a7:56:1d:7d:f5:c7:76:ee:2a:33.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'sredsvr8,10.80.1.32' (DSA) to the list of known hosts.
oracle@sredsvr8's password:
directory_list.Z     100% |**********************************************************************************************************|   545 KB    00:00
Solaris:/export/home/oracle/andrew >

Once the file was back on the Tru64 machine, I uncompressed it to prove that you could compress a file on a Solaris machine then uncompress it on a Tru64 machine. Finally I used the diff command to check that the uncompressed file matched the backup copy, which I made at the start of the example:
 
Tru64:/usr/users/oracle/andrew > ls -l directory_list*
-rw-r--r--   1 oracle   dba       558245 Feb  5 15:15 directory_list.Z
-rw-r--r--   1 oracle   dba      1971685 Feb  5 14:43 directory_list_save
Tru64:/usr/users/oracle/andrew > uncompress directory_list.Z
Tru64:/usr/users/oracle/andrew > ls -l directory_list*
-rw-r--r--   1 oracle   dba      1971685 Feb  5 15:15 directory_list
-rw-r--r--   1 oracle   dba      1971685 Feb  5 14:43 directory_list_save
Tru64:/usr/users/oracle/andrew > diff directory_list directory_list_save
Tru64:/usr/users/oracle/andrew >

Monday, 14 January 2013

How to Tell if a UNIX User is Locked

You can check if a UNIX user is locked with the passwd -s command, followed by the username. If the letters LK appear at the start of the output, after the username, the user is locked:

Solaris root user > passwd -s oracle
oracle    LK    06/15/12     7    56     7
Solaris root user >

You can unlock a user with the passwd -u command, followed by the username:


Solaris root user > passwd -u oracle
passwd: password information changed for oracle
Solaris root user>

After unlocking the user, the letters PS replace the letters LK in the output of the passwd -s command. This simply means that the user has a password:


Solaris root user > passwd -s oracle
oracle    PS    06/15/12     7    56     7
Solaris root user >

In Spanish / en espaƱol