Thursday, December 3, 2009

SRC (System Resource Controller)commands in AIX


SRC commands in AIX

lssrc -a      To list the status of all subsystems

lssrc -h node1-a    To list the status of all subsystems  on foreign host node1


lssrc -s inetd            To list the status of the subsystem inetd

lssrc -g tcpip            To get the status of the subsystem group tcpip 

startsrc -s inetd         To start the subsystem inetd

startsrc -g tcpip        To start the subsystem group tcpip


stopsrc -s inetd      To stop the subsystem inetd (if process is under srcmstr. ie PPID of process=PID of srcmstr)


stopsrc -g tcpip   
        To stop the subsystem group tcpip


refresh -s nfsd            To refresh nfsd subsystem


refresh -g tcpip  
          To refresh tcpip subsystem group


lssrc -p [PID of process]  To get  status of the subsystem by process ID 

kill  [PID of process]   To kill a process that not started by srcmstr 

mkssys       To add a subsystem

rmssys -s kerberos        To remove the subsystem kerberos


chssys -s kerb -s kad        To rename the subsystem kerb to kad





*************

Wednesday, December 2, 2009

User related commands in AIX


User related commands in AIX


id                To list all system identifications for current user

id -gn                To list the default group for current user

id -Gn                 To list all system groups for current user

lsuser root            To list the attribute of user root

lsuser ALL            To list the attributes of all users

lsuser -a ALL            To list all usernames 

lsuser -a HOME ALL        To list the home directory of all users

lsuser -a auth1 auth2 ALL        To list the authentication method for all users

lsuser -a expires ALL        To list expiry date

lsuser -a account_locked ALL     To check account lock status of all users

chuser -a login=true praveen        To enable the user praveen

chuser -a rlogin=true username        Enable user to login remotely to server 

mkuser praveen   Creates user si with default values in /usr/lib/security/mkuser.default

passwd   To change password of current user

passwd username  To change password of a user

pwdadm username  To change password of a user by security (admin) member

mkuser su=false username       Create user without su facility

rmuser username            To remove a user

rmuser -p praveen            To remove user praveen and his all attributes

who          List users with tty nos and ip numbers

who /var/adm/wtmp        Lists history of login logout system startup and shutdown

last root  All previous login and logoff time of root user

who -r     To list the current run level ( cat /etc/.init.state )

whoami   show current user

who am i         To list the exact user (who -m) ( ie. difference between su and su - After su shows previous username bcoz environment not set for current user and su - shows current username bcoz environment has been set)

mkgroup dcm            To create the group dcm

chgroup users=user1,user2,user3 dcm    To add users user1,user2 and user3 to dcm  group

rmgroup dcm            To delete the group dcm

chauthent            To change the authentication methods

chuser unsuccessful_login_count=0 username   To change the unsuccessful login count

pwdck -t ALL / Username  To verify user passwords ( Report error and ask to fix it)

usrck -t ALL / Username   To verify user definition.

grpck -t ALL / groupname  To verify a group




*************


Print commands in AIX

Print commands in AIX

switch.prt  -d    to Display current print subsytem (AIX, System V, BSD) 

switch.prt  -s AIX   to change current print subsytem to AIX 

switch.prt  -d systemV    to change current print subsytem to systemV

qprt -P  qname filename   To submit print jobs (AIX Printing)


qprt -P:lp1 filename   To submit a print job if multiple queue / printer is there 

qprt -N   No. of print copy required 

qchk -q                To display the default q

qchk -P lp0            To display the status of the printer lp0


qchk -# 123           To display the status of job number 123


qchk -A                To display the status of all queues (AIX Printing) 


qcan -x 123            To cancel the print job 123 (AIX Printing)

qcan -X -P lp0            To cancel all jobs submitted to lp0
(AIX Printing)

qchk -L  to show job priorities 

qpri -#570 -a 25            To change the priority of the job to 25

qhld -# 569            To hold the  job 569


qhld -r -#569            To remove holding job 569 (release)


qmov -m pq1 -#11        To move the job 11 to queue pq1


enable psq            To enable queue psq


disable psq            To disable queue psq


lp -d qname filename  To submit printjob (System V printing)

lp -n   No. of print copy required


lpstat                 To display the status all queues (System V printing) 

lpstat -p lp0            To display the status of print queue lp0

lpstat -u root            To display the jobs submitted by user root


cancel -#111            To cancel job 111
(System V printing)

lpq -P lp0            To display the status of queue lp0  ( BSD Printing )






************



Backup commands in AIX


Backup commands in AIX


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

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


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


mkszfile                Creates /image.data file


mkcd -d /dev/cd1            Creates system boot backup to the CD-R device /dev/cd1    (mksysb)



mkcd -d /dev/cd1 -v datavg        Creates  backup of VG datavg to CD-R device /dev/cd1   (savevg)


savevg -i -f /dev/rmt0 datavg    Creates datavg.data image file and backup vg datavg (path = /tmp/vgdata/datavg/datavg.data)



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


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


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


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


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


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

restore -Pa -vf /dev/rmt0 ./etc/passwd    Restore only a file attribute from tape

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

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

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

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


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


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


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


dd if=file1 of=file2 conv=ebcdic    Convert and copy ascii file to ebcdic file2


dd count=1 bs=4k skip 31 seek=1 if=/dev/hd4 of=/dev/hd4    copy 31st block and paste to 1st block in the hd4 ( ie.to fix currupted superblock by restoring it's backup copy to original location)



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


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


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


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

tcopy /dev/rmt0.0 /dev/rmt1.0   to copy contents of 1st tape(tape0) to 2nd tape(tape1). It is useful when the size of the tapes are different.


tcopy /dev/rmt0     to show no. of files and block size in the tape



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






******************



Tuesday, December 1, 2009

How to's in AIX

1) How to disable telnet in AIX

How to disable telnet in AIX

  
#vi /etc/inetd.conf

comment out telnet from this file (#telnet ... ... .. )

save it and

#refresh -s inetd

Then telnet session will be disabled in that server from now.


2) HOW TO FIX A CORRUPTED BLV IN AIX



3) HOW TO DO LINK AGREGATION IN AIX



4) HOW TO CONFIGURE NTP IN AIX