Tanti Technology

My photo
Bangalore, karnataka, India
Multi-platform UNIX systems consultant and administrator in mutualized and virtualized environments I have 4.5+ years experience in AIX system Administration field. This site will be helpful for system administrator in their day to day activities.Your comments on posts are welcome.This blog is all about IBM AIX Unix flavour. This blog will be used by System admins who will be using AIX in their work life. It can also be used for those newbies who want to get certifications in AIX Administration. This blog will be updated frequently to help the system admins and other new learners. DISCLAIMER: Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility. If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.

Thursday 31 October 2013

SuSE Linux - Quick Reference


SUSE Linux – Quick Reference
Note: All configuration files are kept under /etc/sysconfig directory. Changes made using yast tool will update all config file. But if you do any changes in the files manually, run /etc/SUSEconfig.

YASTYet Another Setup Tool is a system management tool available in SuSE Linux. This is like smitty in AIX , sam in HP-UX.

There are 2 versions available
a) yast - Text based like smitty
b) yast2 - GUI based like smit

Here are some fast paths available for yast

autoyast
backup
bootloader
ca_mgm
cd-creator
cdrom
common_cert
controller
dhcp-server
dirinstall
disk
dns
dns-server
dsl
fax
firewall
groups
heartbeat
host
http-server
hwinfo
idedma
inetd
inst_source
instserver
ipsec
isdn
kerberos-client
keyboard
lan
language
ldap
ldap-server
lvm_config
mail
modem
mouse
nfs
nfs_server
nis
nis_server
ntp-client
online_update
pci_id
power-management
powertweak
profile-manager
proxy
remote
restore
routing
runlevel
samba-client
security
slp
support
sw_single
sysconfig
tftp-server
timezone
update
users
vendor
wol
x11
you_server


For example, to manage users type
# yast users

------------------------------------------------------------------------------------------------

Security Management
Files/etc/passwd Contains user configuration
/etc/shadow Contains user password
/etc/group Contains group configuration
/etc/login.defs Contains default values for login
/etc/default/useradd Contains default values for new users
/etc/issue Contains initial message for users
/etc/motd Contains message of the day
/etc/sudoers Configuration file for sudo
/etc/ssh/sshd_config ssh configuration file
/etc/nologin

Commandsuseradd Creates user
usermod Modifies user’s attributes
userdel Deletes user
groupadd Creates a group
groupmod Modifies group’s attributes
groupdel Deletes a group
passwd Sets password for a user
passwd –l user1 Locks a user
passwd –u user1 Unlocks a user
passwd –S user1 Shows the status of user account
pwck Checks user config files
pwconv Corrects user config errors in /etc/passwd
and /etc/shadow files
id user1 Shows user info like uid, gids
finger user1 Shows additional info about the user
groups user1 Displays group membership of user1
chage –l user1 Displays passwd policy for user1
su - -c “grep user1 /etc/shadow” To execute a command as root user
newgrp dbagroup Changes effective GID
lastlog Shows the contents of /var/log/lastlog
faillog Shows the contents of /var/log/faillog
last Shows last logged in users
who Shows currently logged in users

------------------------------------------------------------------------------------------------

BOOT

GRUB (Default Boot Loader)/boot/grub/menu.lst Boot menu configuration file
/etc/grub.conf GRUB configuration file
grub-install /dev/sda Re-installs the boot loaded

LILO/boot/message Boot menu configuration file
/etc/lilo.conf LILO configuration file

KERNEL
/boot/vmlinuz kernel image
/boot/initrd Initial RAM disk file
/lib/modules/version/kernel/ Location of kernel modules
lsmod Lists currently loaded modules
insmod module Loaded indicated module into kernel
rmmod module Unloads the indicated module from kernel
modprobe module Loads or unloads (with –r ) a particular module
modinfo module Displays information about a module
/etc/modprobe.conf Configuration file for kernel modules
/etc/modules.conf Affects how modules are loaded

LOG FILES
/var/log/boot.msg - Contains boot messages. Use dmesg command to view this file
/var/log/messages - Contains system messages

RUN LEVELS

Available Runlevels are

0 - System halt
S - Single user mode, from the boot prompt only
1 - Single user mode
2 - Local remote user mode without remote network like NFS
3 - Full multiuser mode with network
4 - Not used
5 - Full multiuser mode with network and X Display Manager (like KDM, GDM, XDM)
6 - System reboot

Commands
init 5 To goto runlevel 5
/etc/init.d/rc#.d Dir. Containing start/stop scripts used while changing run levels
/etc/init.d/rc Script runs with runlevel # as parameter while changing the run level
shutdown –h now Shuts down the server immediately


Device Configuration
hwinfo –scsi Lists all scsi devices
hdparam To view info about your hdisk and manage
certain hdisk parameters
fdisk Used to manage partition table
lspci Displays info on all pci buses
siga SUSE tool to gather h/w info

Some naming conventions …

/dev/sda - First SCSI hard disk
/dev/sdb - Second SCSI hard disk
/dev/sda1 - First partition in first SCSI hard disk
/dev/sda2 - Second partition in first SCSI hard disk
/dev/st0 - First SCSI tape drive
/dev/nst0 - First SCSI tape drive in no rewind mode


System and Process Info

top Like topas(aix), prstat(solaris)
uptime Shows system uptime
ps Shows process info
netstat -r Shows routing table
netstat –i Shows ip configuration
netstat –a Shows listening and non-listening sockets
iostat Shows cpu, I/O statistics
sar System Analysis reporter
vmstat Shows cpu, vm statistics
free Shows memory statistics
uname –r Shows kernel release
uname –m Shows hardware architecture
uname –p Shwos processor type
/etc/SuSE-release Contains OS version


Network Configuration
Configuration Files
/etc/sysconfig/network/ifcfg-* Files containing data specific to network device
/etc/hosts Contains IP to hostname mapping
/etc/host.conf Used for name resolution
/etc/nsswitch.conf Used for name resolution order
/etc/networks Contains network name and address
/etc/resolv.conf Contains domain server address and search
/etc/HOSTNAME Contains hostname w/o domain name attached
/etc/sysconfig/network/routes Contains static route information
/etc/sysconfig/network/config Contains general settings for the behavior of ifup, ifdown, if status
/etc/sysconfig/network/dhcp Contains settings for DHCP
/etc/sysconfig/network/wireless Contains settings for wireless
/etc/nscd.conf Config file for Name Service Cache Daemon

Start-up Scripts
/etc/init.d/network Configures network h/w & s/w during boot
/etc/init.d/inetd Starts internet daemon
/etc/init.d/portmap Starts portmapper
/etc/init.d/nfsserver Starts NFS server
/etc/init.d/sendmail Controls sendmail process
/etc/init.d/ypserv Starts NIS server
/etc/init.d/ypbind Starts NIS client

Additional Scripts
/etc/sysconfig/network/scripts/ifup-route Sets up a route
/etc/sysconfig/network/scripts/ifdown-route Disables a route
/etc/sysconfig/network/scripts/ifstatus-route Checks the status of a route
ifup Makes all network interfaces up
ifdown Makes all network interfaces up

------------------------------------------------------------------------------------------------------------

LVM

PV Commands
pvcreate /dev/sda Initialises a physical volume
pvscan Displays configured PVs
pvdisplay Displays PV properties
pvmove /dev/hdb /dev/hdc Moves pe’s to another pv
fdisk Used for creation of partitions on a PV

VG Commands
vgcreate myvg /dev/sda /dev/sdb Creates a volume group
vgdisplay Displays vg properties
vgextend myvg /dev/sda6 Extends a vg
vgreduce myvg /dev/sda5 Reduces a vg
vgchange –a y myvg Activates a vg
vgchange –a n myvg Deactivates a vg
vgexport myvg Exports a vg
vgimport myvg /dev/sda1 Imports a vg

LV Commands
lvcreate –L 10G –n homevol myvg Creates a logical volume
lvextend –L 12G /dev/myvg/homevol Extends a logical volume
lvremove /dev/myvg/homevol Removes a logical volume

------------------------------------------------------------------------------------------------------------

FS Commands

Available Types
ext2, ext3, reiserfs, jfs, xfs, nfs, ufs, ntfs

/etc/fstab Like /etc/filesystems in AIX, /etc/vfstab in Solaris
/etc/mtab Maintains the lsit of currently mounted file systems
df –h Shows filesystem table in human readable format
dumpe2fs Shows details about a ext2 or ext3 file system
tune2fs –f /dev/hda6 Converts ext2 to ext3 filesystem
mount /dev/sdc6 /space Mounts a file system
umount /space Unmount a file system
umount –f /space Forcibly unmounts a filesystem
fuser –xc /space To figureout why a file system is busy
lsof Lists open files


Creation
mkfs –t ext2 –v /dev/sda6 Creates a ext2 type filesystem in the 6th
partition of the 1st scsi hard disk
mke2fs /dev/myvg/homevol Creates a ext2 file system
mkreiserfs /dev/myvg/myvol Creates a reiserfs filesystem on myvol lv

File System Extension
resize2fs /dev/myvg/homevol Increases a ext2 file system
ext2resize /dev/myvg/homevol Increases a ext2 file system
resize_reiserfs –f /dev/myvg/homevol Increases a reiser file system
e2fsadm /dev/myvg/homevol –L+512M Extends a LV as well as FS

File System Checkfsck /dev/hda4 Checks a file system
e2fsck /dev/hda3 Checks a file system of type ext2
reiserfsck /dev/hda2 Checks a file system of type reiserfs
e2fsck -f -b 32768 /dev/hda1 Restores superblock from 32768th backup
location

Quotausrquota, grpquota Options used in /etc/fstab to define quota for filesystems
/etc/init.d/quota start Starts quota system
/etc/init.d/quota stop Stops quota system
/usr/bin/quotaon filesystem Starts quota system on a particular filesystem
/usr/bin/quotaoff filesystem Stops quota system on a particular filesystem
quotacheck Checks partitions having quota keyworks in /etc/fstab
edquota –u user For setting up user quota
edquota –u group For setting up group quota
eduota –p user1 user2 Copies quota of user1 to user2
repquota –aug Generates a quota report

------------------------------------------------------------------------------------------------------------

Software Management

Log Location /var/adm/inst-log/installation-*
Configuration File /usr/lib/rpm/rpmc
Database Files /var/lib/rpm/
Package Naming Convention name-version-release.architecture.rpm

RPM Commandsrpm –i pine-4.44-188.rpm Installs a package
rpm –U pine-4.44-188.rpm Upgrade a package
rpm –F pine-4.44-188.rpm Freshens a package
rpm –e pine-4.44-188.rpm Uninstalls a package
rpm –q pine Query for a package in the database
rpm –qf /sbin/fsck Finds out to which package file belongs to
rpm –ql pine-4.44-188.rpm Displays file list
rpm –qi pine-4.44-188.rpm Lists package information
rpm -qp --basedon Checks if the patch is suitable for the system
pine-4.44-224.i586.patch.rpm
rpm –checksig pine-4.44-188.rpm Checks the signature of the package
rpm –qpPl pine-4.44-224.i586.patch.rpm Displays the files affected by the rpm

------------------------------------------------------------------------------------------------------------

PROC Files

/proc/cpuinfo Contains Processor info
/proc/meminfo Contains memory info
/proc/uptime Contains system uptime
/proc/version Contains kernel version
/proc/filesystems Contains file systems compiled into kernel
/proc/swaps Definition of swap partitions
/proc/devices Lists major numbers and device groups
/proc/fs/nfs/exports Contains info similar to /etc/exports
/proc/ioports Lists of currently registered i/o ports
/proc/mounts Shows currently mounted file systems
/proc/net Contains various network pseudo files
/proc/partitions Lists partitions, their major/minor device nos.
/proc/pci Lists available pci devices
/proc/scsi Directory with scsi files and driver directories
/proc/sys Directory corresponding to kernel variables
/proc/sys/kernel/hostname Contains hostname
/proc/sys/kernel/domainname Contains domain name
/proc/sys/kernel/osrelease Contains os release
/proc/sys/kernel/ostype Contains type of os
/proc/sys/kernel/version Contains version


Note: You can use sysctl command for modifying kernel parameters

------------------------------------------------------------------------------------------------------------

Backup

mt –f /dev/st0 status Displays the status of first SCSI tape drive
tar Just like AIX/Solaris tar
dd Just like AIX/Solaris dd
gzip –l file1 Archives the binary file to a zip file named file1.gz
gzip –d file1.gz Uncompress the file file1.gz
bzip2 file1 Archives the binary file to a zip file named file1.bz2 using bzip2 utility
bzip2 –d file1.bz2 Uncompress the file file1.bz2

------------------------------------------------------------------------------------------------------------

Network Time Protocol

/etc/ntp.conf NTP Configuration File
rcxntpd start Starts xntp daemon
ntpq –p Sync and verifies ntp configuration/connection

------------------------------------------------------------------------------------------------------------

User Limit

ulimit Command used to control the user’s limitations on
system resources like memory, cpu, etc..
ulimit –m 98304 Limits physical memory usage to 96MB for the current user
ulimit –v 98304 Limits virtual memory usage to 96MB for the current user

------------------------------------------------------------------------------------------------------------

Log File Rotation

/etc/logrotate.conf NTP Configuration File

logrotate is controlled through cron and it is called daily by /etc/cron.daily/logrotate.

------------------------------------------------------------------------------------------------------------

Access Control List – ACL

getfacl /home/raja/mydir Lists the current acl for mydir

setfacl -m user:jane:rwx,group:oradba:rwx mydir
Provides rwx permissions for user jane and group oradba

------------------------------------------------------------------------------------------------------------

Secure Shell – SSH

Note: SuSE Linux installs the package OpenSSH by default. The programs ssh, scp,
and sftp are then available as alternatives to telnet, rlogin, rsh, rcp, and ftp.


ssh server1 "uptime; mkdir tmp" Runs commands in server2
ssh raja@server1 Establishes ssh connection to server1 as user “raja”
scp –r src/ server2:/backup/ Securely copies the entire directory of src to servers’s backup directory
sshd Server side daemon listens on port tcp/ip 22
ssh-keygen –t rsa Generates public, private keys
$HOME/.ssh/id_rsa File containing private key
$HOME/.ssh/id_rsa.pub File containing public key

No comments:

Post a Comment