Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, June 25, 2015

View Contents of .zip file without Extracting

View Contents of .zip file without Extracting:
To see the contents of zips is to use the familiar ‘unzip’ command with a simple -l flag. The reported information is not as detailed as ‘zipinfo’ but it still includes meaningful details including individual file size, file modification date and time, total file count, and file names.
$ unzip -l archive_name.zip
Sample output of the command is shown below:
[root@R12PRODDB R122_Stage]# unzip -l V29764-01.zip
Archive:  V29764-01.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
    20863  12-20-2011 03:14   readme.htm
        0  12-19-2011 13:39   Disk1/
        0  12-19-2011 13:41   Disk1/install/
        0  12-19-2011 13:39   Disk1/install/linux64/
      686  07-19-2011 05:26   Disk1/install/linux64/oraparam.ini
        0  12-19-2011 13:39   Disk1/install/linux64/resource/
    14341  12-01-2010 16:37   Disk1/install/linux64/resource/cons_pt_BR.nls
    14601  12-01-2010 16:36   Disk1/install/linux64/resource/cons_es.nls
    15518  12-01-2010 16:36   Disk1/install/linux64/resource/cons_ko.nls
    15228  12-01-2010 16:36   Disk1/install/linux64/resource/cons_de.nls
    16440  12-01-2010 16:36   Disk1/install/linux64/resource/cons_ja.nls
    15557  12-01-2010 16:36   Disk1/install/linux64/resource/cons_fr.nls
    14691  12-01-2010 16:36   Disk1/install/linux64/resource/cons_it.nls
    13366  12-01-2010 16:36   Disk1/install/linux64/resource/cons.nls
    12110  12-01-2010 16:37   Disk1/install/linux64/resource/cons_zh_CN.nls
    12175  12-01-2010 16:37   Disk1/install/linux64/resource/cons_zh_TW.nls
   145976  12-01-2010 16:37   Disk1/install/linux64/unzip
   161745  12-01-2010 16:37   Disk1/install/linux64/runInstaller
        0  12-19-2011 13:39   Disk1/plugins/
        0  12-19-2011 13:39   Disk1/plugins/sjsws/

Thursday, June 26, 2014

Host key verification failed.

I was trying to scp files from one server to another server.

when I hit scp it scolded me that "Host key verification failed."

[appprd@host01 PRD]$ scp -pr xxlpr apptst@host02.domain.com:/u02/app/apptst/
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE host01 IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA Host key has just been changed.
The fingerprint for the RSA key sent by the remote host01 is
80:f3:c5:26:16:d1:9a:23:8d:c9:00:44:84:75:1a:7f.
Please contact your system administrator.
Add correct host01 key in /u01/app/appprd/.ssh/known_hosts to get rid of this message.

Offending key in /u01/app/appprd/.ssh/known_hosts:5
RSA host01 key for host02.domain.com has changed and you have requested strict checking.

Host key verification failed.

lost connection

Cuase: The same Host was registered with different key in $HOME/.ssh/known_hosts file


Solution:

Temporary: mv /u01/app/appprd/.ssh/known_hosts /u01/app/appprd/.ssh/known_hosts_old. Once the job is done replace again.

Permanent(in fact correct): remove the host01 key entry from $HOME/.ssh/known_hosts.

When you try scp again it will prompt you to add the new key, say yes. The new key will be added in known_hosts file. 

Now it will not give your the error.

[appprd@host01 PRD]$ mv /u01/app/appprd/.ssh/known_hosts /u01/app/appprd/.ssh/known_hosts_old
[appprd@host01 PRD]$ scp -pr xxlpr apptst@host02.domain.com:/u02/app/apptst/

The authenticity of Host 'host02.domain.com (192.168.1.102)' can't be established.
RSA key fingerprint is 80:f3:c5:26:16:d1:9a:23:8d:c9:00:44:84:75:1a:7f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'host02.domain.com,192.168.1.102' (RSA) to the list of known hosts.
apptst@host02.domain.com's password:

Thursday, June 19, 2014

Search alert log for error, time and occurances


----------+
grep Linux|
----------+



grep -A 1 -B 1 -C 1 '' 

where  -A 1 --one line after expression match
 -B 1 --one line befor expression match
 -C 1 --one line before & after expression match



----------+
grep SunOS|
----------+


nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=2 a=4 s="string" file1



where "b" and "a" are the number of lines to print before and after string "s" in file1.

Friday, September 6, 2013

How To scp, ssh and rsync without prompting for password

How To scp, ssh and rsync without prompting for password
By jkini on Oct 17, 2007

Whenever you need to use scp to copy files, it asks for passwords. Same with rsync as it (by default) uses ssh as well. Usually scp and rsync commands are used to transfer or backup files between known hosts or by the same user on both the hosts. It can get really annoying the password is asked every time. I even had the idea of writing an expect script to provide the password. Of course, I didn't. Instead I browsed for a solution and found it after quite some time. There are already a couple of links out there which talk about it. I am adding to it...

Lets say you want to copy between two hosts host_src and host_dest. host_src is the host where you would run the scp, ssh or rsyn command, irrespective of the direction of the file copy!

On host_src, run this command as the user that runs scp/ssh/rsync

$ ssh-keygen -t rsa
--------------------
This will prompt for a passphrase. Just press the enter key. It'll then generate an identification (private key) and a public key. Do not ever share the private key with anyone! ssh-keygen shows where it saved the public key. This is by default ~/.ssh/id_rsa.pub:

Your public key has been saved in <your_home_dir>/.ssh/id_rsa.pub
                         -----------------------------------------
Transfer the id_rsa.pub file to host_dest by either ftp, scp, rsync or any other method.
-----------------------------------------
On host_dest, login as the remote user which you plan to use when you run scp, ssh or rsync on host_src.
Copy the contents of id_rsa.pub to ~/.ssh/authorized_keys
---------------------------------------------------------
$ cat id_rsa.pub >>~/.ssh/authorized_keys
-----------------------------------------
$ chmod 700 ~/.ssh/authorized_keys
------------------------------------
If this file does not exists, then the above command will create it. Make sure you remove permission for others to read this file. If its a public key, why prevent others from reading this file? Probably, the owner of the key has distributed it to a few trusted users and has not placed any additional security measures to check if its really a trusted user.

Note that ssh by default does not allow root to log in. This has to be explicitly enabled on host_dest. This can be done by editing /etc/ssh/sshd_config and changing the option of PermitRootLogin from no to yes. Don't forget to restart sshd so that it reads the modified config file. Do this only if you want to use the root login.

NLS boot file not found or invalid opmnctl ping – EBS 12.2 ADCFGCLONE FAIL

Error: adcfgclone.pl failed while performing clone of EBS 12.2 instance. This occurred while ohsT2PApply is in progress. INST_TOP/adm...