Páginas

terça-feira, 2 de outubro de 2012

quarta-feira, 2 de maio de 2012


Trocar a senha via um script

chpasswd
Com o comando "chpasswd" da seguinte maneira:
echo "nom:password" | chpasswd

sexta-feira, 13 de abril de 2012

Authentication refused: bad ownership or modes for file .ssh/authorized_keys

When configuring SSH keys to be able to login to a server without a password you mighkeys2t run into a permissions error. If the authorized_keys or authorized_keys2 file has the incorrect permissions it will not authenticate with your ssh-rsa key but instead still require a password. If you are having trouble configuring SSH keys you should check the /var/log/secure file to see if there is an error displaying in that log. You may see the error displayed below.

Error: Authentication refused: bad ownership or modes for file .ssh/authorized_keys

If you see this error it means that the authorized_keys or authorized_keys2 file has the incorrect ownership or permissions. Make sure that the authorized_keys file is owned by the user that will be logged into and the permissions are 600. So if the username is backup you would want the file to look like the below when issuing the “ls -alh” command.

1        -rw------- 1 backup backup 409 Mar 23 19:56 authorized_keys

If the ownership or permissions are different than the above you can accomplish setting the proper ownership and permissions by using the below two commands.
1        chown backup.backup authorized_keys
2        chmod 600 authorized_keys

That should resolve your problems and now from the remote server you should be able to SSH to this server and login without a password.

quarta-feira, 4 de abril de 2012

A configuração do Certificado digital no IIS 7 é excluída automaticamente.

Sintoma:
O certificado digital desaparece da configuração do IIS e no event view é exibido a mensagem:
SSL Certificate Settings deleted for Port : 172.17.0.22:443 .

Solução:
Locate the following property in the section of the applicationHost.config file, and delete it:
     5506" dataType="Binary" userType="1" attributes="None" value="oXiHOzFAMOF0YxIuI7soWvDFEzg=" />

This property is a legacy feature from Internet Information Services (IIS) 6.0 and is no longer needed.


O arquivo applicationHost.config pode ser encontrado em:

%windir%\system32\inetsrv\config\applicationHost.config

quinta-feira, 29 de março de 2012

 Como testar as operações de SMTP utilizando o Telnet

1. Ligar o Telnet ao Exchange Server que aloja o serviço IMS utilizando a porta 25.
Comando telnet 25
 

2. Ligar o local echo no cliente de telnet para poder ver o que está a escrever.
No Telnet do Win 9x e NT 3.5/4.0 fá-lo através da opção “preferences” do menu “terminal”, e seleccionando o botão de opção do local echo. No Telnet do Windows 2000, escreva o comando "set local_echo", no command prompt.

3. Execute a seguinte sequência de comandos smtp
helo                  
a resposta deve ser a seguinte
250 OK
mail from:
a resposta deve ser a seguinte
250 OK - mail from
rcpt to:
a resposta deve ser a seguinte
250 OK - Recipient
data
a resposta deve ser a seguinte
354 Send data.  Finalizar com CRLF.CRLF
To:
From:
Subject:

.
a resposta deve ser a seguinte
250 OK
quit


Fonte: http://www.rsoutlook.com/exc/telnetsmtp.htm

sexta-feira, 16 de março de 2012

Performance commands for AIX

How to monitor the utilization for all logical CPUs:

gz@aix~# sar -P ALL 1 4
AIX lpar1 3 5 0XXXXXXXXXXX    12/07/11

System configuration: lcpu=4 ent=0.50 mode=Uncapped 

15:19:45 cpu    %usr    %sys    %wio   %idle   physc   %entc
15:19:46  0       57      37       6       0    0.19    37.3
          1       32      22      12      35    0.07    14.9
          2        0      26       0      74    0.00     0.1
          3        0      32       0      68    0.00     0.1
          U        -       -      11      37    0.24    47.7
          -       26      17      15      42    0.26    52.3
15:19:47  0       53      41       6       0    0.18    35.1
          1       24      23       7      46    0.07    13.9
          2        0      27       0      73    0.00     0.1
          3        0      30       0      70    0.00     0.1
          U        -       -      12      39    0.25    50.9
          -       22      18      15      46    0.25    49.1
15:19:48  0       49      37      13       1    0.29    58.4
          1       17      65      10       9    0.19    38.2
          2        0      26       0      74    0.00     0.1
          3        0      34       0      66    0.00     0.1
          U        -       -       1       3    0.02     3.3
          -       35      46      12       7    0.48    96.7
15:19:49  0       53      42       5       1    0.17    33.9
          1       41      21      21      18    0.08    16.9
          2        0      28       0      72    0.00     0.1
          3        0      30       0      70    0.00     0.1
          U        -       -      14      35    0.25    49.1
          -       25      18      19      39    0.25    50.9

Average   0       52      39       8       0    0.21    41.2
          1       25      41      12      21    0.10    20.9
          2        0      27       0      73    0.00     0.1
          3        0      31       0      69    0.00     0.1
          U        -       -       9      29    0.19    37.8
          -       27      25      15      33    0.31    62.2

How to monitor the system wide processor utilization:

gz@aix~# lparstat 1 3  

System configuration: type=Shared mode=Uncapped smt=On lcpu=4 mem=4096 psize=10 ent=0.50 

%user  %sys  %wait  %idle physc %entc  lbusy  vcsw phint
----- ----- ------ ------ ----- ----- ------ ----- -----
 30.5  39.9    7.7   21.9  0.38  76.4   37.0  1550   286 
 27.3  39.7    6.7   26.2  0.36  72.5   40.5  1641   285 
 35.4  46.1    6.5   12.0  0.43  87.0   37.7  1849   369 
 
How to display micropartition statistics with topas:

gz@aix~# topas -L
Interval:    2    Logical Partition: lpar1              Wed Dec  7 15:21:00 2011
Psize:       -                Shared SMT  ON           Online Memory:   4096.0
Ent: 0.50                      Mode: UnCapped          Online Logical CPUs:   4
Partition CPU Utilization                              Online Virtual CPUs:   2
%usr %sys %wait %idle physc  %entc %lbusy    app    Vcsw    phint   %hypv   hcalls
  47   33     9    11   0.4  89.44  26.16      -    2492      411    55.9    40144
==================================================================================
LCPU  minpf majpf  intr    csw   icsw runq lpa  scalls usr sys _wt idl   pc   lcsw
Cpu0    292     0  1456   5072   1093    3 100    9643  52  41   6   1 0.24   1166
Cpu1    344     0   706   3622    849    0 100   11180  54  33   8   6 0.21   1285
Cpu2      0     0    10      0      0    0   0       0   0  26   0  74 0.00     20
Cpu3      0     0    11      0      0    0   0       0   0  29   0  71 0.00     20

How to display cpu utilization of all active partitions in the management system:

gz@aix~# topas -C
Topas CEC Monitor             Interval:  10             Wed Dec  7 15:18:23 2011
Partitions Memory (GB)           Processors
Shr:  5    Mon:79.0  InUse:75.0  Shr:8.5  PSz: 10   Don: 0.0 Shr_PhysB  7.29
Ded:  0    Avl:   -              Ded:  0  APP:  1.3 Stl: 0.0 Ded_PhysB  0.00

Host         OS  M Mem InU Lp  Us Sy Wa Id  PhysB  Vcsw Ent  %EntC PhI
-------------------------------------shared-------------------------------------
lpar1        A53 U   28  27 12  89  8  0  2   4.70    0  4.00 117.6   0
lpar2        A53 U   16  14  8  84  9  0  6   1.55 3188  1.50 103.5 1206
lpar3        A53 U   12  12  6  88  5  0  5   0.72 1426  0.50 143.2 610
lpar4        A53 U   16  15  8   3 10  0 85   0.29 3338  1.50  19.1 399
lpar5        A53 U  8.0 7.8  4   0  1  0 97   0.03    0  1.00   3.4   0

Host         OS  M Mem InU Lp  Us Sy Wa Id  PhysB  Vcsw  %istl %bstl
------------------------------------dedicated-----------------------------------

How to collect and display performance statistics for all logical CPUs in the system. In the example below, we will show one time the 20 seconds data:

gz@aix~# mpstat 20 1

System configuration: lcpu=2 ent=0.8 mode=Uncapped 

cpu  min  maj  mpc  int   cs  ics   rq  mig lpa sysc us sy wa id   pc  %ec  lcs
  0  301    0  160  450  556  262    0   22 100 3808 30 60  0 10 0.05  6.8  392
  1   17    0  160  220   59   41    0   23 100  290 14 48  0 38 0.01  0.8  228
  U    -    -    -    -    -    -    -    -   -    -  -  -  0 92 0.74 92.4    -
ALL  318    0  320  670  615  303    0   45 100 4098  2  4  0 93 0.06  7.6  620

List of processes sorted by swap usage:
gz@aix~# ps gv | head -n 1; ps gv | egrep -v "RSS" | sort +5n
to calculate total used:
gz@aix~# ps gv | egrep -v "RSS" | awk '{total+=$5} END{print total}'

List of processes sorted by memory usage:
gz@aix~# ps gv | head -n 1; ps gv | egrep -v "RSS" | sort +6n
to calculate total used:
gz@aix~# ps gv | egrep -v "RSS" | awk '{total+=$6} END{print total}'

How to artificially limit the amount of memory:

gz@aix~# rmss -c 3000 
Simulated memory size changed to 3000 Mb. 

Tool to check the memory and paging space is allocation:
gz@aix~# svmon (with -P you can see per process allocation)

How to determine the amount of asynchronous I/O (legacy) servers configured on your system:
gz@aix~# pstat -a | egrep ' aioserver' | wc -l
or
gz@aix~# ps -ek | grep aioserver | grep -v posix_aioserver | wc -l

How to display virtual memory statistics:

root@aix53# vmstat -w 1 10 

System configuration: lcpu=34 mem=30976MB ent=5.80

 kthr          memory                         page                       faults                 cpu          
------- --------------------- ------------------------------------ ------------------ -----------------------
  r   b        avm        fre    re    pi    po    fr     sr    cy    in     sy    cs us sy id wa    pc    ec
  0   0    7061457     115394     0     0     0     0      0     0  9595   1833 34264 10 11 77  2  1.27  21.9
  1   0    7061454     115397     0     0     0     0      0     0  9201   1709 33079  9 11 77  2  1.23  21.2
 16   0    7061463     115192     0     0     0     0      0     0 12316   9676 33034 11 19 69  1  1.80  31.0
  3   0    7061464     114619     0     0     0     0      0     0 10842   6207 33429 10 17 68  5  1.66  28.6
  2   0    7061638     114443     0     0     0     0      0     0  6906   4124 28329  7 13 69 12  1.23  21.2
  0   0    7061131     114942     0     2     0     0      0     0  5757   2354 23583  5  9 75 11  0.90  15.5
  5   0    7061613     114457     0     2     0     0      0     0  6230   7724 23951  6  9 77  8  0.96  16.6
  1   0    7062157     113913     0     0     0     0      0     0  6340   2021 24501  6  8 81  5  0.90  15.4
  0   0    7062334     113736     0     0     0     0      0     0  5897   2530 22285  5  7 84  4  0.80  13.7
  2   0    7062425     113645     0     0     0     0      0     0  7378   2931 28937  6  9 82  3  0.92  15.8

A script to get memory utilization:

gz@aix~# cat meminfo
#!/usr/bin/ksh
#
# Quick view of memory usage under AIX
#
 
USED=`svmon -G | head -2 | tail -1 | awk '{ print $3 }'`
USED=`expr $USED / 256`
TOTAL=`lsattr -El sys0 -a realmem | awk '{ print $2 }'`
TOTAL=`expr $TOTAL / 1000`
FREE=`expr $TOTAL - $USED`
 
echo "\nMemory Information"
echo "=================="
echo "total memory = $TOTAL MB"
echo "free memory  = $FREE MB"
echo "used memory  = $USED MB"
 
exit 0 
 
Fonte: http://docs.gz.ro/aix-performance-commands

quinta-feira, 15 de março de 2012

Backup commands for AIX


Creates image.data and system backup (-X expands /tmp if required):
#mksysb -i -X /dev/rmt0

Creates image.data file with map file and system backup:
#mksysb -m /dev/rmt0

Creates system data but excludes the files listed in /etc/exclude.rootvg:
#mksysb -e /dev/rmt0

Creates /image.data file:
#mkszfile

Creates system boot backup to the CD-R device /dev/cd1:
#mkcd -d /dev/cd1

Creates backup of vg vg00 to CD-R device /dev/cd1:
#mkcd -d /dev/cd1 -v vg00

Creates generic boot backup:
#mkcd -d /dev/cd1 -G

Creates vg00.data image file and backup vg vg00:
#savevg -i -f /dev/rmt0 vg00

Creates vg00 backup but excludes files listed in the /etc/exclude.vg00:
#savevg -ef /dev/rmt0 vg00

Backup entire system to rmt0:
#find / -print | backup -ivf /dev/rmt0

Backup /home directory to rmt0 with backup level 0:
#backup -0vf /dev/rmt0 /home

List the archive in rmt0:
#restore -Tvf /dev/rmt0

Restore /home from archive in device rmt0:
#restore -xvf /dev/rmt0 /home

Restores particular file from /export/mksysb image:
#restore –xvf /export/mksysb ./etc/sshd.conf

Archives /home directory:
#find ./home -print |cpio -ocvumB > /dev/rmt0

Create an archive of /home directory:
#tar cvf /tmp/home.tar /home

Restores cpio archive from rmt0:
#cpio -icvdumB < /dev/rmt0

List the contents of cpio archive from rmt0:
#cpio -ivt < /dev/rmt0

Restores /home directory from rmt0:
#cpio -icvd < /dev/rmt0 /home

Archives /home to rmt0 device:
#tar -cvf /dev/rmt0 /home

List the archives in rmt0:
#tar -tvf /dev/rmt0

Extract /home from rmt0:
#tar -xvf /dev/rmt0 /home

Convert and copy ascii file si to ebcdic si1:
#dd if=si of=si1 conv=ebcdic

To copy blocks from rmt0 with 512 blocks to rmt1 with 1024 blocks:
#dd if=/dev/rmt0 ibs=512 obs=1024 of=/dev/rmt1

To rewind the tape:
#tctl -f /dev/rmt0 rewind

To eject the tape:
#tctl -f /dev/rmt0 offline

To show the status of tape:
#tctl -f /dev/rmt0 status

To change the block size of the tape to 512:
#chdev -l rmt0 -a block_size=512

How to restore a file from mksysb:
# listvgbackup -f /path/to/mksysb.image -r ./etc/file

Fonte: http://docs.gz.ro/node/20

sexta-feira, 9 de março de 2012

SRC – Gerenciamento de daemons no AIX

O AIX tem um gerenciador de daemons, chamado SRC, em inglês, “System Resource Controller“.
Através do SRC podemos verificar se um serviço está ativo, parar, iniciar ou reinicializar um serviço.

Isto pode ser feito através dos seguintes comandos:
startsrc: iniciar
refresh: reiniciar
stopsrc: parar
lssrc: verificar status

O SRC permite trabalharmos com um serviço ou um grupo de serviços. Para um serviço, usamos a opção “-s” e para um grupo, “-g”.
Por exemplo, para gerenciar os serviços de NFS:
Verificando status do grupo de serviços:
# lssrc -g nfs
Subsystem            Group    PID    Status
biod                nfs                                     inoperative
nfsd                nfs                inoperative
rpc.statd         nfs                inoperative
rpc.lockd         nfs                inoperative
rpc.mountd          nfs                inoperative

Iniciando um serviço:
# startsrc -s nfsd
# lssrc -g nfs
Subsystem         Group            PID     Status
nfsd             nfs              23672   active
biod             nfs                      inoperative
rpc.statd        nfs                      inoperative
rpc.lockd        nfs                      inoperative
rpc.mountd       nfs                      inoperative

Iniciando um grupo de serviços:
# startsrc -g nfs
0513-059 The biod Subsystem has been started. Subsystem PID is 17242.
0513-029 The nfsd Subsystem is already active.
Multiple instances are not supported.
0513-059 The rpc.statd Subsystem has been started. Subsystem PID is 19862.
0513-059 The rpc.lockd Subsystem has been started. Subsystem PID is 24236.
0513-059 The rpc.mountd Subsystem has been started. Subsystem PID is 6802.

# lssrc -g nfs
Subsystem         Group            PID     Status
nfsd             nfs              23672   active
biod             nfs              17242   active
rpc.statd        nfs              19862   active
rpc.lockd        nfs              24236   active
rpc.mountd       nfs              6802    active

Parando um grupo de serviços:
# stopsrc -g nfs
0513-044 The nfsd Subsystem was requested to stop.
0513-044 The biod Subsystem was requested to stop.
0513-044 The rpc.statd Subsystem was requested to stop.
0513-044 The rpc.lockd Subsystem was requested to stop.
0513-044 The rpc.mountd Subsystem was requested to stop.

# lssrc -g nfs
Subsystem         Group            PID     Status
biod             nfs                      inoperative
nfsd             nfs                      inoperative
rpc.statd        nfs                      inoperative
rpc.lockd        nfs                      inoperative
rpc.mountd       nfs                      inoperative
 
Fonte: http://www.unixnotes.org/2007/01/31/src-gerenciamento-de-daemons-no-aix 

quinta-feira, 8 de março de 2012

AIX - Identificando portas abertas

É muito importante conhecer o ambiente que está sendo administrado. Em se tratando de servidores, muitas vezes temos em um ambiente muitas portas abertas (em modo listen), e é importante saber qual processo está ouvindo em uma determinada porta, por questões de segurança e até em situações de troubleshooting.

A dica de hoje é identificar, no AIX, qual processo está sendo executado em uma porta específica.

Método 1 - Usando os comandos netstat e rmsock

Protocolo TCP:

# netstat -Aan |grep *.1334

f1000e0002b753b0 tcp4       0      0  *.1334             *.*                LISTEN

# rmsock f1000e0002b753b0 tcpcb

The socket 0x2b75008 is being held by proccess 5701822 (writesrv).

# ps -ef |grep 5701822

root  5701822  1507536   0   Jun 10      -  0:00 /usr/sbin/writesrv

Como podem ver o processo writesrv está sendo executado na porta 1334.

Protocolo UDP:
# netstat -Aan |grep *.514

f1000e0002a67e00 udp4       0      0  *.514              *.*

# rmsock f1000e0002a67e00 inpcb

The socket 0x2a64c08 is being held by proccess 5308580 (syslogd).

# ps -ef |grep 5308580

root  5308580  1507536   0   Jun 10      -  0:36 /usr/sbin/syslogd

A porta 514 UDP está sendo utilizada pelo processo do syslogd.

Método 2 - Utilizando os comandos netstat e kdb (kernel debuger)

# netstat -Aan |grep 1334
f1000e0002b753b0 tcp4       0      0  *.1334             *.*                LISTEN

# kdb

(0)>
(0)> sockinfo f1000e0002b753b0 tcpcb

[... A saída do comando kdb é bem detalhado, e por isso foi truncado. O importante para nós é a ultima linha, como mostrado abaixo ... ]

proc/fd: 87/3
proc/fd: fd: 3
              SLOT NAME     STATE      PID    PPID          ADSPACE  CL #THS

pvproc+015C00   87*writesrv ACTIVE 05700BE 01700D0 0000001190239480   0 0001

O importante é saber o PID do processo, que está em hexadecimal na coluna PID.
 

Para converter de hexadecimal para decimal, basta utilizar o comando hcal, dentro do prompt do kdb. Como mostrado abaixo.

(0)>
(0)>
(0)> hcal 05700BE
Value hexa: 005700BE          Value decimal: 5701822
(0)> quit

De volta ao shell, verificar qual programa pertence ao PID 5701822.

# ps -ef |grep 5701822

root  5701822  1507536   0   Jun 10      -  0:00 /usr/sbin/writesrv

O mesmo procedimento pode ser utilizado para portas UDP, sempre trocando o parâmetro tcpcb por inpcb.

Dica válida para AIX versões 5.3 e 6.1


Fonte: http://www.vivaolinux.com.br/dica/AIX-Identificando-portas-abertas