Monday 23 March 2015

Parallel processing with xargs simple example




-----------------------------------------------------------------------------------------------
rasim@IT-rasim:~$ time (seq 1 10 | xargs -n 1 -P 10 sleep)

real 0m10.008s
user 0m0.007s
sys 0m0.011s
rasim@IT-rasim:~$ time (seq 1 10 | xargs -n 1 -P 5 sleep)

real 0m15.009s
user 0m0.010s
sys 0m0.016s
rasim@IT-rasim:~$ time (seq 1 10 | xargs sleep)

real 0m55.005s
user 0m0.003s
sys 0m0.004s
-----------------------------------------------------------------------------------------------

Wednesday 12 March 2014

Linux Driver check commands

Drivers trouble shooting.

lspci: lspci -k % List the Device driver and kernal module which handles it %

eg:
---------------------------------------------------------------------------------------------------------------------------
root@dummy54:~# lspci -k
00:00.0 Host bridge: Intel Corporation Ivy Bridge DRAM Controller (rev 09)
    Subsystem: Toshiba America Info Systems Device ff1e
    Kernel driver in use: agpgart-intel
00:02.0 VGA compatible controller: Intel Corporation Ivy Bridge Graphics Controller (rev 09)
    Subsystem: Toshiba America Info Systems Device fb20
    Kernel driver in use: i915
    Kernel modules: i915
00:14.0 USB controller: Intel Corporation Panther Point USB xHCI Host Controller (rev 04)
    Subsystem: Toshiba America Info Systems Device ff1e
    Kernel driver in use: xhci_hcd
00:16.0 Communication controller: Intel Corporation Panther Point MEI Controller #1 (rev 04)
    Subsystem: Toshiba America Info Systems Device ff1e
    Kernel driver in use: mei
    Kernel modules: mei
00:1a.0 USB controller: Intel Corporation Panther Point USB Enhanced Host Controller #2 (rev 04)
    Subsystem: Toshiba America Info Systems Device ff1e
    Kernel driver in use: ehci_hcd
00:1b.0 Audio device: Intel Corporation Panther Point High Definition Audio Controller (rev 04)
    Subsystem: Toshiba America Info Systems Device ff1e
    Kernel driver in use: snd_hda_intel
    Kernel modules: snd-hda-intel
00:1c.0 PCI bridge: Intel Corporation Panther Point PCI Express Root Port 1 (rev c4)
    Kernel driver in use: pcieport
    Kernel modules: shpchp
00:1c.1 PCI bridge: Intel Corporation Panther Point PCI Express Root Port 2 (rev c4)
    Kernel driver in use: pcieport
    Kernel modules: shpchp
00:1d.0 USB controller: Intel Corporation Panther Point USB Enhanced Host Controller #1 (rev 04)
---------------------------------------------------------------------------------------------------------------------------


lsmod: lsmod % List the kernal modules loaded in the system %

eg:
-------------------------------------------------------------------------------------------------------------------------
root@dummy54:~# lsmod
Module                  Size  Used by
pci_stub               12622  1
vboxpci                23200  0
vboxnetadp             13382  0
snd_hda_codec_hdmi     32474  1
vboxnetflt             23441  0
parport_pc             32866  0
snd_hda_codec_realtek   223867  1
vboxdrv               287130  3 vboxpci,vboxnetadp,vboxnetflt
rfcomm                 47604  12
ppdev                  17113  0
bnep                   18281  2
btusb                  18288  2
bluetooth             180104  23 rfcomm,bnep,btusb
binfmt_misc            17540  1
arc4                   12529  2
rts5139               351143  0
uvcvideo               72627  0
videodev               98259  1 uvcvideo
v4l2_compat_ioctl32    17128  1 videodev
joydev                 17693  0
snd_hda_intel          33773  3
-------------------------------------------------------------------------------------------------------------------------

Wednesday 5 March 2014

Plesk repository for rpms

Hi all,

Check out the  following link which gives you official Plesk rpms.

-----------------------------------------------
http://autoinstall.plesk.com/
-----------------------------------------------

I came across this accidentally. Have not completely checked this out.
Hope it helps all of you.


Learn & share
Rasimuddin V.S

How to change the time zone of a server in CentOS server






----------------------------------------------------------------------------------------------------------------------------
[root@test ~]# ls -al /etc/localtime
lrwxrwxrwx 1 root root 33 Aug 20  2012 /etc/localtime -> /usr/share/zoneinfo/Europe/London
[root@test ~]# cat /etc/sysconfig/clock
ZONE="Europe/London"
[root@test ~]# cat /etc/issue
CentOS release 6.3 (Final)
Kernel \r on an \m
----------------------------------------------------------------------------------------------------------------------------

Sunday 2 February 2014

Commands

commands
================================
apache.and.php.recompilation: /scripts/easyapache
apache.installation: ./configure --prefix=/usr/local/apache --enable-module=rewrite --enable-shared\module=so
     $ make
     $ make install
     $ /usr/local/apache/bin/apachectl start
nmap: nmap  -p(port) <no> <ip> %to check which port is open floods the port not recommended%
ssh: ssh -p <no> <user@ip>
ssh: ssh -p <ip> -Y %to get grapical settings %
ssh: ssh -L 7777:localhost:3306 root@mysql.server.com % ssh tunnel to mysql server%
scp: scp -p2243 file remotehost (rasim@192.168.1.5:/folder)

scp: scp -r </path/filename> <login name@ip address>:.%to send file to a remote computer "."=current directory%
scp: scp -r [login name@ip address] : [/path/filename] . %to retrive from a remote location%
tail: tail -f (for real time error reading) tail -f /usr/local/apache/logs/error_log
tar: tar -xvf foo.tar verbosely extract foo.tar
tar: tar -xzf foo.tar.gz
tar:          extract gzipped foo.tar.gz
tar:
tar:   tar -cjf foo.tar.bz2 bar/
tar:          create   bzipped   tar  archive  of  the  directory  bar  called
tar:          foo.tar.bz2
tar:
tar:  tar -xjf foo.tar.bz2 -C bar/
tar:          extract bzipped foo.tar.bz2 after changing directory to bar
tar: tar -xzf foo.tar.gz blah.txt
tar:  extract the file blah.txt from foo.tar.gz
tar:  tar -zxvf file.tar.gz  (extract with verboes{screen runnig with details})
elinks: elinks link address %used for accessing a webaddress %
dig: dig -h(compleate help but no help) dig @8.8.8.8 (digs the db record from the specified nameserver)
dig: dig +trace google.com(trace the domain from the root),dig -x 220.225.192.90 (traces the ip to domain using arpanameservers)
dig: dig +short activelobby.net(this just gives you the corresponding ip of the domain),dig +short -x207.191.228.36 (gives fqdn)
dig: dig A activelobby.net,dig MX/SOA activelobby.net(this gives the respective records in the nameserver
dig: dig A activelobby.net @202.138.103.100 +norecurse (checks wheater the A record is cached in the particular NS)
dig: dig txt % checks wheather for spf dnskeys etc %
dig: dig IN MX @ns1.netdns.net footymanager.net +short % new %
grep: bascisyntax is grep 'word' filename options, -v root filename opposite of grep,-n to display the no also,--color color display
grep: -l list the filename where the occurance happen,-L to list files without pattern,-c count the no of times it occured
grep: -C 2 context print 2 lines before and after the occurance,-A lines after the occurance,-B before the occurance,
grep: -W for looking up the exact word,grep -r "192.168.1.5" /etc/ %to look recuresivly on all files under the /etc/%
grep: -i to make the search case in sensitive, grep "lines.*empty" demo_file %search line starting with lines and end in empty%
grep:  * like ? The preceding item is optional and matched at most once,{n}preciding item matched excatly n times,{n,}preciding     
grep:  matched more than n times,{,m} The preceding item is matched at most m times,{n,m} The preceding item is matched at least n
grep:  times, but not more than m times,grep -v -e "a" -e "b" -e "c" test-file.txt % appending more pattern to search%
grep:  grep -o "is.*line" demo_file to highlight only the pattern,
grep:  grep "tell_" -r public_html %grepping under a directory recursively to get something%
grep: grep 'pattern1\|pattern2' filename % checks first pattern or second pattern %
grep: grep -E 'pattern1|pattern2' filename % checks first or secont pattern %
grep: grep -E 'pattern1.*pattern2' filename % grep AND usage %
grep: grep -E 'Manager.*Sales|Sales.*Manager' employee.txt % manager and sales in order %
find:  !find to run the last find command run on the machine,find / -maxdepth 2 -name local%find local under root if maxdepth 1
egrep: egrep 'pattern1.* pattern2.*pattern3'% (Anding)checking fot 3 patterns together%
egrep: egrep 'pattern1 | patten 2 |pattern3'% (Oring) checking for either patterns %

find:  if maxdepth is 2 then under a directory under root%,find -mindepth 3 -maxdepth 5 -name passwd here the folder is looked
find:  under 2 level of root upto 5 levels of root,
find:  here the '.' specifies to look in the current directory,find . -perm 777 –print%find a file with permission 777%,
find:  find -maxdepth 1 -not -iname "MyCProgram.c"%this will invert the match%,ls -i1 test*%find inode of a file%
find:  find -inum 16187430 -exec mv {} new-test-file-name \;%finding the file with iname and renaming it,
find:  find ~ -empty %to find empty files in home directory%,# find . -type s %find only socket files% ,
find:  -type d %only directories%,-type f %only files%,-size +100,-size -100 %based on size >or< 100 %
find:  # alias rmao="find . -iname a.out -exec rm {} \;" # rmao %creating alias of find and remove file%
find:  find . -mtime -1 %finding files which has been modified in the last 1day -mmin to specify time in minutes%
find:  find / -atime -1%finding files that got accessed with in last 1 day%, -amin -60 %gets file accessed in last 60min%
find:  find / -ctime -1%which got changes basically inode%,-cmin %which got changed in min%
find:   find -newer FILE %find files modified after the FILE%
find: find -anewer FILE %find files accessed after modification of FILE%
find:  find -cnewer FILE %find files changed after modification of FILE%
find: find <CONDITION to Find files> -exec <OPERATION> \;%eg find -mmin -60 -exec ls -l {} \;%
find:  find / -name "*.conf" 2>>/dev/null %to redirect the error messages%
find: find / -gid n %find files with group id n,fing / -group gname files with given groupname;
find: find / -nouser <userid> %find files which are not used by the given user%
find: find / -nogroup <group-id> %find files which does not belong to the given group-id%
find: find / -type %files of given type like l=sybolic-link f=regular-files s=socket%
find: find . -name "*.php" -print | xargs chmod 644
find: find ./ -type d -exec chmod 755 {} \;
find: find ./ -type f -exec chmod 644 {} \;
lsattr: lsattr <filename> %gives you the file attributes of the given filename%
chattr: %The format of a symbolic mode is +-=[ASacDdIijsTtu].%
chattr: %a=the file can only be opened in append mode for writing%
chattr: %c=when it is set the file is compressed on disk by kernal%
chattr: %i= a file with i attribute cannot be deleted%
chattr: %u= when a file with this attribute is deleted it can be restored(undeletion)%
chattr: %A= when a file with A attribute is accessed its atime record is not modified%
chattr: %S= when a file with this attribute is set changes are written synchronously on the disk%
chattr: %D= when a directory with this attribute is sethe changes are written synchronously on the disk%
chattr: %d= file with the ‘d’ attribute set is not candidate for backup when the dump(8) program is run%.

chown: chown rasim.rasim <info1.php> %used to set user and group for a file%
mv: mv -i=byasking -f=forcefully -t=move all sorce arguments into directory
cp: cp <source> <destination> %-r=recursivley --copy-contents=copies evry contents -p=maintains the date properties%
cp: cp -pr source destination
yum: yum install <pacakge> %installs the package >
yum: yum info <package> %gives info wheather the package is installed>
yum: yum list installed %lists everything which is installed in this computer%
yum: yum install <package> --exclude "*.i386" % Excluding the package i386"
awk:   awk '{print $1}' file %prints the first column of the given file%
awk:  ls files_list | awk '{print "mv "$1" "$1".new"}' | sh %renames the files in the given files_list%
awk:  awk -F ":" '{print $1}' <filename>
awk: find /home/ -type f -size +104857 -exec ls -lh {} \; | awk '{ print $9 ": " $5 }' % to find file size bigger %
kill:
pgrep: pgrep -u <username> %lists the pids under the user name%
pgrep: pgrep <processname> %gives u the process id of the process given%
ps:
df: df -h%to list diskusage%
du: du -h %to list diskusage
du: du -sch * %to list diskusage in current directory%
du: du -h
du: du -h --max-depth=1
du: du -h --max-depth=1 | grep M
seq: seq 1000 %prints nos upto 1000%
top: top -cd 1 %gives you compleate path%
top: top -c %gives you compleate path
top: top -u user to view process acording to user
top: top -d <timedelay> to specify time delay in refresh
top: top -p pid to display just related to the process id
top: %RES coloumn details the current memory in use by the process it maybe a figure with shared memory of lib%
top: %status% 'D' = uninterruptible sleep
top: %status% 'R' = running
top: %status% 'S' = sleeping
top: %status% 'T' = traced or stopped
top: %status% 'Z' = zombie
top: %top after options are i: to show runnig process t: shows or hides tasks u: ->UID/username filters user%
top: % 1: gives you the no of cpus in the system,z:highlights running process,c: gives full path%
top: % b: highlights running process, n: limits tasks ,m: gives memoryusage detais,l:gives loadavg detail%
lvetop: %to find out the user usages in cloud linux systems%
renice: %alter priority of running processes%
renice:

du:  du -sh * %to list the usage of all files in the directory also used with -sch%
chkconfig: %chkconfig has five distinct functions: adding new services for management, removing services from management%
chkconfig: %listing the current startup information for services, changing the startup information for services%
chkconfig: %and checking the startup state of a particular service.%
chkconfig: chkconfig --list %lists the startup things%
chkconfig: chkconfig httpd on %will add chkconfig to startup%
whereis : %whereis - locate the binary, source, and manual page files for a command%
whereis : %to find configuration and things like registry%
rsync: %to copy from a remote user%
rsync:  rsync --verbose --progress --stats --compress --recursive --times --perms --archive
 

netstat: -a %list all ports using netstat(did not see 80),-r gives you the default routing table,-p all the processes related
netstat: -l gives you the lisening sockets,-x to filter traffic for unix,-t traffic on tcp,-u traffic on udp,-s stats of a protocol
netstat: -n gives you numericports user and we can filter it using --numeric-ports,hosts,users ,-i list of interfaces
tcpdump: tcpdump -i <interface> -n port 25
who: who %gives you who all are logged in currently
whoami: %checks the user under which we are running%
passwd: passwd <username> %to setup passwd for the given username%
passwd: passwd -d <username> ,passwd --delete <username>%to delete passwd to null and freeze the accout%
useradd: useradd <username> %adds user should be follwed passwd <username> other wise user is blocked%
useradd: useradd -e <yyyy-mm-dd> <username> %sets a date for the user to get disabled %
useradd: useradd -e 2009-12-31 -f 30 jerry % -f used to set expiry of password in 30 days for jerry account%
useradd: useradd -c <comment> <username %will give a comment for the user%
useradd: useradd -g <group-name> <username> %this will add the user to the group(212198*)% %not useful check%
useradd: %the above commandis like adding a=$new$= user with a diffrent primary groupname but uid=gid %
useradd: useradd -G <group-name> <username> %this does not make the group primary group of the user%
usermod: %used to change existing users to diffrent groups %
usermod: usermod -g <GID=12> <UID=2> %user(primary gid=12,uid=2),gid and uid just show to understand%
usermod: usermod -a -G <GID=12> <UID=2>%user(primary gid=2,uid=2,2dary gid=12)%
usermod: -a %used to append only used with -G to show it just append does not modify%
usermod: usermod -s /sbin/nologin <user> %user shell is set up to no login it is used to modify shell of a user%
usermod:
userdel: -f forces even if logged -r remove the files associated with the user%deletes the user%
users:
groupadd: groupadd <group-name> %adds a group with GID but not UID%
groupdel: groupdel <groupname> %deletes a given group%


groups:  groups <username> %gives you the groups in which the user belongs%
chfn: chfn <username> %editing comments in /etc/shell%
chsh: chsh -s /bin/false tom%command for editing shell in /etc/passwd%
id:     id -g <username> %gives you the primaryid of the group of the given user% 
id:     id -G <username> %gives you the supplementary id of user as well% -u %can be used to get user%
id:     id -Gn <username>,id -gn <name> %gives you the name of the groups%
lsof: lsof -p 1448 %gives information about open files regarding to process%
pushd: %to go to the directory which you like%
popd:  %to go back to the directory location from which directory path was pushed%
printenv: %prints the enviorment variables of the shell%
cut: %used to cut vertically a file each coloumn is a vertical line%
cut: cut -c1-6 <filename> %cuts the first 6 letters each line in the file%
cut: cut -c1,8 <filename> %cuts just the first and 8th letter in each line%
cut: cut -d: -f3 <filename> %it cuts the third word in front of the delimiter%
cut: cut -d: -f3- <fielname> %it cuts from the third to the end of the file%
pidof: pidof exim %gives you the pid of the exim%
exim: exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | bash
crontab: crontab -l % to view crontab entries%
crontab: crontab -e % to edit current crontab entries%
crontab: crontab -u <sathiya> -l %to view other users crontab entries%
crontab: crontab -u <user> -e %to view other users crontab entries%
maldet: maldet -a <path> %scans using malware%
maldet: maldet -a /home/gruporoyal/domains/gruporoyale.com/
repquota: repquota /home %Use this command to check for quotas on a specific partition%
sudo: sudo -i % to make current user super user %
su: su supervisor % check it out %
htop: htop -d 11 %
iftop: iftop -i <ehernet interfae> %monitor trafic switch T to switch b/w in and out traffic
sar: sar 1 123









lsof: lsof -p <process-id>
w: user informations are given
w: w top %dont know what this is %
wc: wc -l %counts the no of lines in the file or input%
uptime: %gives the up time of the system and averages of last 1,5,15 min%
date: %displays current date% -R=with GMT also
date: date +"%a-%d-%m-%y"=>Mon-14-11-11 %to do it in diffrent formats%
date: date --date='15 days ago' %displays date 15 days ago%%ithink -- fetches the date 15 days back to the date register%
stat: stat <filename> %gives you the timestamp details of the file%
touch: % Update  the  access  and modification times of each FILE to the current time.%
touch: touch <file>%creates a file%,touch -r=copies time stamp <file1> <file2> %copies the time stamp of file1 to file2%
touch: touch -r <file1> <file2> <file3> <file4>%copies the time stamp of file1 to all other files%
touch: touch -a=accesstime <file> %changes only the access time of the file%,-m=modification time
touch: touch -c=dont create if exists <file>%does not create a file if it does not exist%
touch: touch –t 8804152240 <file> %sets timestamp according to out need % -d=we can define the timestamp structure
free: free -m % command is used to view the free memory in the system%
mail: mail -i <email-address> %for mailing from local domain%
mail: mail
mutt: mail listing
ln: ln -s /etc/httpd/conf web %soft link from web to /etc/httpd/conf %
ln: ln /home/hermie/projects/snowgun/formula.txt sgformula %hard link %
getenforce: % to check selinux is enabled or disabled%
setenforce: %setenforce '0' or one for off and on of selinux%
rpm: rpm -qa % to know what all rpms are installed%
rpm: rpm -e % removing the rpm with dependencies %
rpm: rpm --test %test
rpm: rpm -i % installing something%
rpm: rpm -qi psa %info of installed file %
rpm: rpm -Uvh % to install %
rpm: rpm -Uvh --force % forcing to do it %
rpm: rpm -e --nodeps % removing rpm without dependencies%
awk: awk '/search pattern1/ {Actions} /search pattern2/ {Actions}' file %basic syntax%
awk: % "/searchpattern/" searches '//' word in the pattern while {Actions} perform the action
awk: search is case sensitive %
awk: awk '{ print $1 "string" $2} file' %insert the string in between $1 and $2 $0=whole line%
awk: awk '{ print $NF}' % prints the last field %
awk: BEGIN { Actions} {ACTION} # Action for everyline in a file END { Actions } % BEGIN {} executes the
awk: initial functions before an action and END{} executes the function after the search # is used as
awk: comment in the awk command %
awk: % basically every field could be used as variables $1 $2 etc inside '' we can use operators like
awk: >,>= inside the '' for manupulation "~"= comparing string for %
awk: awk '$1 = /100/' test %displays if first field is 100%
awk: awk 'BEGIN { count=0;} $4 ~ /Tech/ { count++; }END { print "No of tech=",count;}' file1
awk: % counts the no of time $4= Tech%
awk: % // searches uses the AND and OR combinations like the egrep %
awk: awk 'BEGIN{ MS=0;TS=0} $3~/manager/{MS+=$NF}/trainee/{TS+=$NF} END {print MS,TS}' test2
awk: awk -f script-filename inputfilename % to input script already written %
awk: awk -F 'FS' 'commands' filename % FS is input field separator varible %
awk: awk 'BEGIN{FS=":";} {print $1"\t"$3"\t"$4"\t"$6;} END {}'
awk: awk -F':' '{print $3,$4;}' /etc/passwd
awk: % OFS=output field separator variable normally it is a SPACE %
awk: awk -F':' 'BEGIN{OFS="=";} {print $3,$4;}' /etc/passwd % outputs 41=41,345=345 basically controls
awk: output of the field %






netstat:  netstat -n | grep :80 | grep SYN |wc -l % check this out ddos attacks%
===========================================================================
iptables: iptables -F % flushing all the table%
iptables: iptables -save % save the configuration%
iptables: iptables -A INPUT -s 65.55.44.100 -j DROP
iptables: iptables -nL|grep -i drop % Gets dropped ips in the server %
iptables: iptables -A INPUT -i <iface> -s 192.168.2.6 -j ACCEPT
iptables: iptables -A INPUT -p tcp --dport 25 -j DROP
mail: mail -vv <email-address> % to send mail%

network:/etc/sysconfig/network-scripts/ifup-routes venet0:0
network:/... changed RATE="*:1:8 " to RATE="eth1:1:8192 " in virtuozzo config
======================================================================


rdesktop: rdesktop 77.235.42.193:3389 -u administrator -ppassword -0(for getting console add -0) remote login to windows
rdesktop: rdesktop 77.235.42.193 -u administrator -ppassword default port is assigned as 3389
iisreset: iisreset /start|restart|stop used to operate iis
inetmgr: used to open iis
sqlcmd: sqlcmd -S <servername> -U <username> -P <password>
eventvwr: to view event viewer
==========================================
MYSQL
==========================================
mysqladmin: mysqladmin -u root -prasim newpassword 'misar' %to reset password for admin of mysql%
mysqladmin:  mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow` extended-status | grep Max_used_connections | Max_used_connections | 11 |
mysql: mysql -u root -p %mysql login %
mysqladmin: mysqladmin proc stat %to view current procedures in the mysql%
mysql: mysql acapulco_z8aXewo < /mysqlbackup/weeklydbbackup_20111126/acapulco_z8aXewo.sql%take in%
mysql: mysql dump acapulco_z8aXewo < /mysqlbackup/weeklydbbackup_20111126/acapulco_z8aXewo.sql
mysql: mysqladmin proc stat % to know mysql process%
mysql: show processlist\G % gives accouding to user%
mysql: update user set password=PASSWORD("NEW-PASSWORD-HERE") where User='tom';
mysql: mysql -V % To check mysql version%
mysql: GRANT ALL ON <database> TO username@'localhost' IDENTIFIED BY 'password';
mysql: grant all on swinful_db.* to ‘swinful’@localhost identified by ‘swinfuls_password’;
mysql: flush privileges; %after using grant use this to ensure updation%
mysql: mysqlcheck <database_name> %checks the mysql database specified%
mysql: mysqldump -u root -prasim activelobby_rasim>backup2.sql
mysql: mysql>CREATE DATABASE activelobby_rasim;
mysql: mysql>CREATE TABLE employee_data (emp_id INT,name VARCHAR(20),designation VARCHAR(20),age INT);
mysql: mysql>INSERT INTO shamu_data (emp_id,name) values(14,'shamu');
mysql: mysql> show tables ;
mysql: mysql> SELECT DATABASE();
mysql: mysql> DESCRIBE employee_data;
mysql: mysql> USE rasim_activelobby;
mysql: mysql> select * from employee_data;
mysql: mysql>UPDATE `wp_users` SET `user_pass` = MD5('CUS7H/oq4p') WHERE `wp_users`.`user_login` = 'admin';
mysql: mysqld_safe --skip-grant-tables Starting mysqld daemon with databases from /var/lib/mysql
mysql:
mysql: --user=root mysql;update user set Password=PASSWORD('razeem2121981#') where user='root';flush privileges;
mysql: mysql -u username -p mydb1 < /location/of/the/file/i/want/to/upload.sql;
mysql: mysqldump -u username -p db1> backup.sql
mysql: mysqlcheck -c <database> <table> -u root -p
mysql: mysqlcheck -r <database> <table> -u root -p
mysql: mysqlcheck -o <database> <table> -u root -p
mysql: mysqlcheck -c  -u root -p --all-databases % checks all databases %
mysql: mysqlcheck -c alfresco  -u root -p % checks only databases %
mysql:  DROP TABLE am_about;
mysql: grant all privileges on bioenerg_forum.* to bioenerg_forum@localhost identified by 'seacole-007';
mysql: mysql> drop database [database name]; % to drop db%
mysql: mysqladmin -u root -p drop TUTORIALS % to drop database %
mysql: DELETE FROM tablename; % to delete all the rows from a database %
mysql: TRUNCATE TABLE tablename;  % to delete all the rows from a database %
mysql: JOIN % Returns rows when there is at lease one match in both tables%
mysql: LEFT JOIN % Returns all rows from the left table even if there are no match with right table%
mysql: RIGHT JOIN % Return all rows from the right table evern if there are no match wht left table%
mysql: FULL JOIN % Returns rows when there is a match in one of the tables%
mysql: INNER JOIN % keyword return rows when there is at least one match in both tables%
mysql: Wildcards % %= zero or more words, _= substitute for one character %
mysql: mysql -uadmin -p`cat /etc/psa/.psa.shadow ` psa -e"select * from Components" %using mysql from outside%
rdate: /usr/bin/rdate -s servername
replace: cat gi | replace 'rasim' 'razeem'
replace: replace "rasim" "razeem" -- <filename>


http://www.howtoforge.com/installing-mysql-administrator-tool-to-connect-to-remote-databaseS

fdkfjdklfjd

================================
updatedb: %updates database for locate commmad%
==============
php: php --ini gives you the default path of our php.ini
php: php -i %gives u almost everything related with php.
=====================
perl harry/killmail: %to delete all mails rounding up or undelivered mail from home folder%
=======================================================
====================================================
rm -vf /tmp/sess_[a-d]* ; rm -vf /tmp/sess_[a-o]* ; rm -vf /tmp/sess_[a-z]* ; rm -vf /tmp/sess_[0-4]* ; rm -vf /tmp/sess_[0-9]* ; rm -vf /tmp/sess_* ; rm -vf /tmp/cache_* ; rm -vf /tmp/*.dat ; perl /root/harry/killmail* ; /etc/init.d/crond restart ; /etc/init.d/dovecot restart
====================================================================
pidof pop3 %gives you all the pid under pop3%
kill -9 `pidof pop3'
netstat: netstat -plane | grep :80 | awk {'print $5'} | cut -d: -f4 |sort | uniq -c
netstat -plane | grep :53 | awk '{print $5}' | cut -d ':' -f1 | sort | uniq -c
====================================================================
sar: sar -q %load monitoring%
sar: sar -1 132132 %load monitoring with interval%
zip: zip -r  <zipped> <file> %To zip some files%
strace:
===============================================


find . -name "*.php" -print | xargs chmod 644
find ./ -type d -exec chmod 755 {} \;
find ./ -type f -exec chmod 644 {} \;
ps aux | awk '{ print $8 " " $2 }' | grep -w Z
find: find /home/ -maxdepth 4 -mindepth 2 -name redprojection.com -type d
find:  find * -iname '*.pl' -ls % plesk hack find%

==============================
CSF
==============================
csf: csf -d <ip> %deny the ip%
csf: csf -td <ip> % deny the ip temporarily%
csf: cd /usr/local/src;rm -fv csf.tgz;wget http://www.configserver.com/free/csf.tgz;tar -xzf csf.tgz;cd csf;sh install.sh % install csf %


========================
php
=======================
php: exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source %disable functions%
=========================
Exim
=========================
exim: exim -bpc %Print a count of the messages in the queue%
exim: exim -bp %Print a listing of the msg in queue (time queued, size, message-id,sender, recipient)%
exim: exim -bp | exiqsumm %Print a summary of msg in queue (count, volume, oldest, newest,domain, and totals)%
exim: exiwhat %Print what Exim is doing right now:%
exim: exim -bt alias@localdomain.com user@thishost.com %Test how exim will route a given address%
exim: exim -bt user@thishost.com %Test how exim will route a given address%
exim: exim -q -v %Start a queue run%
exim: exim -ql -v %Start a queue run for just local deliveries%
exim: exim -Mrm <message-id> %Remove a message from the queue%
exim: exim -Mf <message-id> %Freeze a message%
exim: exim -qf %Force another queue run%
exim: exim -qff %Force another queue run and attempt to flush the frozen message%
exim: exim -Mvl msgid %View the log for the message%
exim: exim -Mvh msgid %View msg headers%
exim: exim -Mrm messageID %Remove message without sending any error message%
exim: exim -Mg messageID %Giveup and fail message to bounce the message to the Sender%
exim: exim -bpr | grep frozen | wc -l %How many Frozen mails in the queue%
exim: exim -bpr | grep frozen | awk {'print $3'} | xargs exim -Mrm %Deleteing Frozen Messages%
exim: exim -bp | grep "<>" | awk '{ print $3 }' | xargs exim -Mrm
exim: exim -bt -d test mail %
exim: %The flags are:<= message arrival, => normal message delivery,-> additional address in same delivery%
exim: %*> delivery suppressed by -N, ** delivery failed; address bounced,== delivery deferred; temporary problem%
mail: mail -v rasimvs@gmail.com
exim: exim -bt -d test mail
exim: exim -M msgid %forcing a message to go %
exim: exim -bP %to display configurations%
exim: exim -bh 192.168.1.7 %Run a pretend SMTP transaction from the command line, as if it were coming from the given IP
exim: This will display Exim's checks, ACLs, and filters as they are applied. The message will NOT actually be delivered%
exim: exim -Mvb <message-id> %view message body%
exim: exiqgrep -o 432000 -i | xargs exim -Mrm %remove mails >5days%
exim: exiqgrep -i -f luser@example.tld | xargs exim -Mf %freeze msg from a sender%
exim: exim -v -odf user@remote.host % check exim mail send with verbose %
exim: exim -bt user@remote.host % check that Exim can route to the address %


=========================================================
mount
mount 192.168.1.75:/active   /mnt
=====================================================
scripts: /scripts/pkgacct <acc_name> %accout name%

rndc reload requipsa.com.mx

grep version language/en-GB/en-GB.xml
ssl: openssl x509 -text -in cert.pem
ssl: openssl x509 -in server.panayiotou.me.crt -text -noout


dd: dd if=/dev/zero of=/tmp/test.img bs=1024M count=1
chattr +ia index.php
[root@server50 public_html]# lsattr
----ia------- ./index.php

shutdown: shutdown /r /f /t 1
======================================
VPS Manupulation
======================================
vzlist: vzlist -a % list all vps in a node%
vzpkgls: vzpkgls <vzid> %gives you the vps package details%
vzctl: vzlicview % To check which licences are currently installed %
vzctl: vzctl enter 664 %to enter vps %
vzctl: vzctl --save % saves configutaions%
vzctl: vzctl stop %stops%
vzctl: vzctl --faststop % need editing%
vzctl: vzctl set <Vzid> -ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
-save --diskinodes 600000:600000 %increase inodes%
vzctl: vzctl set <Vzid> --save --diskspace 55555555:55555555 %increase disk space%
vzctl: vzctl set XXX --save --nameserver 77.235.32.150 % dns resolver%
vzctl: vzctl set VPS_ID --ipadd <ip_address>  %add ip to a vps%
vzctl: vzctl set VPS_ID --ipdel <ip_address>  % delete ip from vps%
vzctl: vzctl destroy <vzid>
vzctl: vzlicview % To check which licences are currently installed %
vzctl: vzctl exec <vps_id> netsh firewall set opmode disable %disable firewall in windows mode%
vzctl: test_vzsrvapi query VE_ID % to find reason for VPS lock out %
vzctl: vzctl stop <VE_ID> --fast ;vzctl reinstall <VE_ID> --skipbackup % to reinstall vps fast%
vzctl: vzctl set <VE_ID> --save --offline_service vzpp --offline_management yes
vzctl: vzctl set VEID  --disktype compact;vzctl stop VEID --fast;vzctl start VEID %reduce disk space by vps%
vzctl: vzpkg update VEID % to update operating system packages of VPS%
vzctl: vzsveinstall -u % repairing vps %
vzctl: vzctl set 101 --vpn on --save % to enable vpn in VPS%
vzctl: vps stop: vzctl set <vzid>  --save --disabled yes % to disable for overusage %
vzctl: vzctl set <vzid> --save --disabled no % to enabe vps%
vzctl: vzpkg install <vzid> -p yum
vzctl: vzrestore
vzmlocal: vzmlocal -c <vzid>:<newvzid>
vzctl: /home/vz/backup %bakc
vzctl:vzrestore -d <lanip> -e <ctid> % from the back uplocation execute the command and make
vzctl:sure that vps is stopped%
vzctl:vzpkgadd 11269 plesk-9.5.3.0
vzstat: vzstat %I input output write,o-sorted ouput,h-help,b-brief %
vzpid:
vzctl: vzallcmd " df -h "
vzlist: vzlist -o ctid,laverage
vzstat: vzstat -om
vzpath: /etc/vz/vz.conf %Configuration files for the node%
vzpath: /etc/vz/conf/<CT_ID>.conf %container configuration %
vzpath: /vz/root/CT_ID % This is a path to the Container root directory where the private area is mounted.%
vzpath: /vz/private/CT_ID % private data %
vzctl: vzctl set CT_ID --hostname <name> % set hostname %
vzctl: vzctl set CT_ID --ipdel <ip_address> % del IP %
vzctl: vzctl set CT_ID --ipdel all % delete all IP %
vzctl: vzctl reinstall 2345 --skipbackup --resetpwdb % To reinstall the container with the current os will have to reset the password%
vzmlocal: vzmlocal -C 10974:1097400000 % To clone a container %
vzctl:  vzctl destroy 11258 % To destroy a container %
sar: %load checking %`
watch: watch ls -la /vz/lock
=======================================
qmail: /var/qmail/bin/qmail-qstat % To check the mail queue in plesk from command line, you can use the command %
qmail: /var/qmail/bin/qmail-qread % You can examine the queue with qmail-qread. %
qmail: find /var/qmail/queue -iname 524514 % To find the messages in the queue %
qmail: /var/qmail/queue/remote/22/524514
qmail: /var/qmail/queue/mess/22/524514
qmail: /var/qmail/queue/info/22/524514
qmail: vi /var/qmail/queue/mess/22/524514 %From the mail header you get the IP address%

==========================================================================================
postfix

postfix: qshape incoming active hold deffered   | head % get queue info%
unsorted

httpd -V % location of apache conf
du -h --max-depth=1
netstat -n | grep :80 | grep SYN |wc -l
ps -p 28379 -fh -eww

/usr/local/psa/admin/sbin/autoinstaller --select-release-current --install-component postfix
=======================================
Plesk
=======================================
plesk: dbclient.exe --direct-sql --sql="select * from databaseservers" %to retrive mysql and plesk password%
plesk: C:\> "%plesk_bin%"\dbclient --direct-sql --sql="select su.login, a.password from accounts a, sys_users su  where
plesk: a.id=su.account_id and su.login='USER1'" %user name and password of a%
plesk: dbclient.exe --direct-sql --sql="select name from data_bases where type='mssql'" % gives you the data base names%
plesk: dbclient.exe --direct-sql --sql="update domains set status=0 where name='savateindia.org'"
plesk: dbclient.exe --direct-sql --sql="select status,name from domains where name='aadiit.com '"%status=0 ok =2 suspended%
plesk: dbclient.exe --direct-sql --sql="select login,passwd from clients where login='pradeep'"
plesk: plesksrvclient.exe -get %plesk admin password %
plesk: -plesksrvclient.exe -get -nogui > plesk_password.txt % if no gui %
plesk: dbclient --direct-sql  --sql="select * from DatabaseServers" %plesk data base password %
plesk: C:\Program Files (x86)\Parallels\Plesk\Databases\MySQL\bin %mysql binaries%
plesk: db_users:database and password for database users,accounts: id and password of accounts
plesk: data_users % mysql database and passwords of the user%
plesk: databaseservers % mysql user name and password %
plesk: dbclient.exe --direct-sql  --sql="update dns_zone set status=0 WHERE name = 'ti-max.com'"
plesk: "%plesk_bin%\reconfigurator.exe" --switch-plesk-web-server --new-provider=apache % switch to apache %
cd: cd /D D:\ % in windows to change volumes%
findstr: findstr pattern <file> %Searches for pattern in files%
echo: echo string %just displays the message to the screen%
echo: @echo off %stops displaying commands used in the process%
del: del <filename> %deletes a files%
netsh: netsh interface ip set dns name="Local Area Connection" static 130.28.55.1 primary %updates dns%
netsh: netsh interface ip set address "Local Area Connection" static %1 %2 %3 1 %set IP '%' is variable %
ping: ping 192.168.1.7 -a -r 3 -n 1 %gets you the host name%
dir: DIR C:\%3 /b /-p /s /a-d | find "C:" % will have to check it our %
dir: dir /s /-p % to view page by page
dir: dir /s /-p % gives you the full path check this out %
dir: dir /s /a-d % another way of search%
for: FOR %%T IN (1 2 3 4 5 6 7 8 9) DO DEL SAMPLE%%T.TXT % for loop%
pause: used to pause the current action and press any key to continue will appear
loop: ":loop ;start a.bat; goto loop;"
del: DEL /F /S /Q %TEMP% % To delete temp files%
rd: rd /s %removes directory with subdirectories %
color: color XX % first x give color of shell second specifies the color of writing no in hex %
REM:  %adding remarks to a batch file%
start: start % opens up a new shell%
start: START /MAX C:\Windows\NOTEPAD.EXE % starts a shell of notepad in maximused mode%
log: % to make a file log file just start it with .LOG it will become log file F5 for time stamp%
netview: To view computers in the network
nbstat: stands for netbios
attrib: ATTRIB -R -H -S C:\IO.SYS % to set attributes to a file %
expand: expand d:\i386\NTOSKRNL.EX_c:\windows\system32 %replace a file in system 32 from recovery mode %
dir: dir c:\explorer.exe /a h /s > look.txt % to check for the file %
ipconfig: (Display Connection Configuration) ipconfig /all
ipconfig: (Display DNS Cache Contents) ipconfig /displaydns
ipconifg: (Delete DNS Cache Contents) ipconfig /flushdns
ipconfig: (Release All Connections) ipconfig /release
ipconfig: (Renew All Connections) ipconfig /renew
ipconfig: (Refreshes DHCP & Re-Registers DNS) ipconfig /registerdns
ipconfig: (Display DHCP Class ID) ipconfig /showclassid
ipconfig: (Modifies DHCP Class ID) ipconfig /setclassid
RD: RD /S /Q dirctory % remove directory %
RD: rd c:\windows\TEMP /s /q ;md C:\windows\TEMP % delete compleate temp%
deltree: deltree /y C:\windows\temp\*.* % delete tree%
route: route ADD % adding route %
netstat: netstat -aonbv % to display ports and executables%
sed: sed -i 's/\/\*km0ae9gr6m\*\/.*\/\*qhk6sa6g1c\*\///g' index.html %to replace b/w words%
sed: cat file | sed '/^$/d' > /root/new.txt %delete blank spaces in a file%
sed: s/goty/rasim/g dream > dream1
sed: sed -i 's/VPS/server/g' fu
wget: wget --http-user=sportdev --http-password=5bce285d06 'link'% download password protected file %
==========
chkconfig
==========
chkconfig: chkconfig --list %list all chkconfig%
chkconfig: chkconfig --list <service-name> % list all service name%
chkconfig: chkconfig --level 2345 <servicename> <on/off>
chkconfig: chkconfig <service name> on

==========
service
==========
service: service <service-name> <start/restart>
==========
xm
==========
xm: xm list % To list the virtual machines %
xm: xm help % to view all the available xm options %
xm: xm create -c domainname/id % create and attach to guest console %
xm: xm console Domainname/id % attach to a VM console %
xm: xm destroy domainname/id % terminates a VM %
xm: xm reboot % reboot a virtual machine, runs through the normal system shut down and start up process%
xm: xm shutdown % shutdown gracefully
xm: xm pause % pause a machine %
xm: xm unpause % unpauses a machine %
xm: xm save % saves an xm %
xm: xm restore% to restore%
xm: xm migrate % to migrate %
xm: xm mem-set % manage resources %
xm: xm vcpu-list % list virtualized cpu affinities%
xm: xm vcpu-pin % resource management %
xm: xm vcpu-set % resource management %
xm: xm sched-credit % command to display scheduler parameters for a given domain %
xm: xm top % top function
xm: xm dmesg %%
xm: xm info %%
xm: xm log %
xm: xm %uptime to display the uptime of guests and hosts%
xm: xm sysrq %%
xm: xm dump-core %%
xm: xm rename %%
xm: xm domid %%
xm: xm domname %%
   
=============
vi - editor
=============
vi: Esc %to enter command mode in editor %
vi: dd % to delete a line%
vi: 2dd % to delete 2 lines like wise xdd deleteds x no of lines%
vi: yy % copies a line %
vi: p % paste a copied line %
vi: u % undo command%
vi: ctrl + r % redo command %
vi: G % moves the cursor to the last line of file%
vi: 5G % moves the cursor to the 5th line %
vi: ZZ % saves and quit from vi %
vi: :1,$s/<word1>/<word2>/gc % replace word1 to word2%
vi: se nu % displays numbers in line%
vi: se nonu % undisplays the numbers in line%
vi: "a % to invoke variables %
vi: "a yy % to copy%
vi: :e!/etc/fstab % to exit from curent file to other file without exiting vi%
vi: "a p % to paste from a register%

=====
fdisk
======
fdisk: fdisk -l % list all partions%
fdisk: fdisk /dev/sda % specify
fdisk: :n add partition,:m gives you help
fdisk: :d delete partition
fdisk: :w to write to partion
fdisk: :q to quit from the fdisk utility.

=====
mount
=====
mount: mount -l % To list all mounts in the system%
mount: mount <devicepartition> /folder % to mount a partition to a folder %
mount:

=========
mkfs
=========
mkfs: mkfs.ext4 /dev/sda8 % To create file system in a new partion for using %
mkfs: mkfs.<file-system> % ext4,ext2,vfat%

========
passwd
========

passwd: passwd <username> % to set password for a user%
passwd: passwd -d <usernme> % user password delete %

==========
groupadd
==========
groupadd: groupadd <groupname> %to add a group%
groupadd: <-g|-o|> <groupname>
groupadd: -g <gid> <groupname> % assign a group to a gid%
groupadd: -g
=========
gpasswd
=========
gpasswd: gpasswd <-a|-M> <user1>,<user2>,<user3> <group % to add a user to a group%
gpasswd: gpasswd <-d | > <user1> <user2> % to delete from group%

========
groupmod
========
groupmod: groupmod -n <newname> <oldname> %To change group name%
groupmod: groupmod -g <gid> <groupname>

========
groupdel
========
groupdel: groupdel <groupname> %To delete a groupname%

========
chage
========
chage: chage <groupname> % to make policies for a group like Minimum Password Age,Maximum Password Age,Last %
chage: %Password  Change, Password Expiration Warning, Password Inactive, Account Expiration Date%

========
useradd
========
useradd: useradd <username> % to add new user %
passwd: passwd <username> % to set password for a user%
useradd: %/etc/passwd file consists of a file with the user information%
useradd: %entry is also added in /etc/group when useradd is executed%
useradd: % entry in shadow is also made with the password in MD5%
useradd: switches <-u|-g|-o|-G|-c|-d|-s > %switches%
useradd: useradd -u 560 -g name % To create user with a specific group%
useradd: useradd -d /var/sdc % to set home directory%
useradd: useradd -c "comment" % command will be added to /etc/passwd
useradd: useradd -G % to add as secondary group%
useradd: useradd -s % to add shell %
useradd: useradd -u 544 -o anu % this will overide even if the userid is already existing%
useradd: useradd -o %this option could be used to overide all settings%
useradd: useradd <user> -u <uid> % if you need a specific userid%

========
usermod
========
usermod: switches <-u|-g|-o|-G|-c|-d|-s > %switches%
usermod: usermod -l <oldname> <newname> % to change login name%
usermod: usermod -L <username> % to lock a user%
usermod: usermod -U <username> % to unlock a user%

========
userdel
========

userdel: userdel <username> % To delete the user%
userdel: userdel -r <username> % To delete the user direcories also%

cp: cp <source> <destination> %copies a file %
cp: cp -r <source> <destination> % to copy directories %

mv: mv <source-file-path> <destination-file-path> % cut and paste%
mv: mv <old-file-name> <new-file-name> % renaming a file%
mv: mv <old-directory <new-directory> % to move a directory%

rm: rm <file-name> % To remove file%
rm: rm -rf <folder> % to remove directories %
rmdir: rmdir er % to remove empty directoried%

file: file <var> % gives you the info of the given attribute whether file or directory of filetype%
bc: bc % Calculator %
date:  % to view date%
cal: cal %gives you the current calender date%
cal: cal 6 2012 %gives you the calender info of 6 month in a year%



wc: wc -c <file> %count -c character count %
wc: wc -w <file> %Count -w word count%
wc: wc -l <file> %Count -l line count%
more: more <filename> % To read the filepage wise use Space and Enter to view line wise but cannot go up in file%
less: less <filename> %To read the file can go up and down the page%
tail: tail -<number> % To read last lines in a files specified by a number %
head: head -<number> % To read the first lines in a file specified by a number%

cat: cat file1 file2 >> file3
cat: cat > file  % for a new file
cat: cat >> file % to append to existing file
echo: echo test >> file % to append contents to a file%

touch: touch file1 file2 file3 file4 % can create multiple files%
mkdir: mkdir dir1 dir2 dir3 dir4 dir5 % multiple directories%
mkdir: mkdir -p /home/rasim/check %to create nested file%


cd: cd - %last path in the register%
cd: cd , cd ~ % goes to the home directory of the current logged in user%
cd: cd ../.. %to go back two directories%
cd: cd % has both absolute path and relative path absolute path will start%
cd: cd % like /root while relative path will just take the point where we %
cd: cd % are as reference pwd path is appended before the path given%
cd: cd % we can find .. files in every folder which can be the soft links in
cd: cd %directory of files to previous files %

setup: setup %System config tool in the system %
mailx: echo "something" | mailx -s "subject" recipient@somewhere.com
mailx:  uuencode /home/Saturday-00-00.sql name.sql | mailx -s "subject" mailid % to send mail with attachment%

++++++++++++++++
plesk linux:
++++++++++++++++
qmail:
1)managed by qmHandle:
2)

=======================================
Mail Enable password
=======================================
C:\Program Files (x86)\Parallels\Plesk\Mail Servers\Mail Enable\Config\
AUTH.TAB

======================================
MSSQL:
======================================
cmd login of mssql
sqlcmd: sqlcmd -S <servername> -U <username> -P <password>


=====================================
Windows
=====================================
dir c:\ /s /b | find "grep"

=====================================
Cisco
====================================
trafshow -ni eth2 port 53 -a 32

======================================
qmail
======================================
qmail: /var/qmail/bin/qmail-qread %to see mails in que%
qmail: /var/qmail/bin/qmail-queue  %no of mails in que%
qmail:

============================================
vbinfo
===========================================
vpopmail: /home/vpopmail/bin/vdominfo agogexpo.com
vpopmail: /home/vpopmail/bin/vuserinfo rasim@agogexpo.com

==========================================
notes psa database
==========================================
domains > hosting > sys_users > accounts

domains: dom_id,dns_zone_id,domainname,
hosting: dom_id,sys_user_id,
sys_users: sys_user_ids,account_id,
accounts : accounts_id,password,
data_bases: dom_id,db_server_id,db_id
db_base: db_id,db_password;

tables: dns_recs,dns_zone_recs

============
Error codes
============

100: Continue
101: Switching Protocols
200: OK
201: Created
202: Accepted
203: Non-Authoritative Information
204: No Content
205: Reset Content
206: Partial Content
300: Multiple Choices
301: Moved Permanently
302: Moved Temporarily
303: See Otherd99tAwrE
304: Not Modified
305: Use Proxy
400: Bad Request
401: Unauthorised
402: Payment Required
403: Forbidden
404: Not Found
405: Method Not Allowed
406: Not Acceptable
407: Proxy Authentication Required
408: Request Time-Out
409: Conflict
410: Gone
411: Length Required
412: Precondition Failed
413: Request Entity Too Large
414: Request-URL Too Large
415: Unsupported Media Type
500: Server Error
501: Not Implemented
502: Bad Gateway
503: Out of Resources
504: Gateway Time-Out
505: HTTP Version not supported
530: username or password error in ftp check
550: 550 Requested mail action not taken:Invalid IP %While sending mail if you are receiving a mail delivery failure message 550: with the reason.Add an spf record to to the domain and try sending mails%
503: %ASP version error try changing it%

====================================
Services and its ports
====================================
995: pop3-secure
993: imap-secure
2222: Direct admin(CP)





===================================
Links
http://www.digicert.com/csr-creation-whm.htm

===================================
https://secure.jabsupport.com/support/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=109&nav=0

[10:45:13 PM] 735: 905  ab -n 50000 -c 10 http://www.astrology.gr/index.php
http://www.linux-faqs.info/virtualization/mount-samba-share-inside-an-openvz-container
http://wiki.openvz.org/User_Guide/Managing_Resources
lsof: lsof /dev/tty1 %Display who is accessing a device%
lsof: lsof +D /usr/bin/ %Show all processes opening files in a directory%
lsof: lsof -u apache Show what a given user has open
lsof: lsof -i TCP %Show all TCP/UDP connections%
lsof: lsof +p 2625 %List open files associated with process ID%
lsof: lsof -i :80 %Shows all networking related to a given port 80%
lsof: lsof | more %Show all opened files%
lsof: lsof -i %Show all opened internet sockets%
lsof: lsof -c bash %You can get information about all instances of a specific program .%
lsof:lsof -a -i TCP -u ryan %view all network socket connections that are owned by the user ryan.%
systeminfo: systeminfo %to get the systeminfo in windows
rsync: rsync -avz --progress --exclude=*.rar --exclude=Thumbs.db --exclude=*.tgz --exclude=*.exe --exclude=*.gz --exclude=*.zip --delete-after /yourmountingpath/* /yourlocalpath/
zgrep: zgrep -e support@symantec.com maillog.processed.1.gz % to grep in gz files %
plesk: /usr/local/psa/admin/bin/mail_auth_view % All mail passwords%
curl: curl ifconfig.me %to find current gateway ip of internet %
wget: wget -qO - canhazip.com % get your public ip%
wget: wget -qO- ifconfig.me/ip %get public IP%
lynx: lynx -dump ifconfig.me | grep "IP Address" % get your publicip %
plesk: "%plesk_bin%\plesksrvclient" -get  -nogui > plesk_password.txt
ping: ping -b 192.168.1.225 %broadcast by using ping command as shown below%
qmail: ./qmail-remove -r -p "velda@grace-int.com" %to remove the corresponding mail-id from queue%
qmail: qmailctl queue |more
replace: replace '<string to be replaced>' '<string which needs to be replaced>' -- filename %replace stirng%
net: net stats srv %windows command to know last time of reboot%
find: find /var/lib/psa/dumps -size +1024M  -exec du -sch {} \; % find files greater than 1 GB
/usr/local/psa/bin/mail -u enquiry@farmart.com.sg -passwd pd$#Ld37RB
smtp: rm -f /tmp/smtpauth.db
cacls: cacls C:\Inetpub\vhosts\istebufirsat.com\httpdocs /T /e /p WIN-6RK3NENN6HU\istebufirsat:C
sar: sar -r %Gives you memory utilization in the server%
strace: strace -o output.txt /bin/foo %Run strace against /bin/foo and capture its output to a text file in output.txt%
strace: strace -p 22254 -s 80 -o /tmp/debug.lighttpd.txt %web process realated to php5 %
strace: strace -e trace=open,read -p 22254 -s 80 -o debug.webserver.txt
autofs: content /etc/auto.home: *   -fstype=nfs,soft,intr,rsize=8192,wsize=8192,nosuid,tcp 192.168.1.9:/home:&
nmap: nmap -sP 192.168.1.0/24 % To get the list of IPs in the network which are up%
vzctl: vzctl set 1039 --cpulimit 10 --burst_cpulimit 10 --burst_cpu_avg_usage 10 --save
mysql -uadmin -p$(cat /etc/psa/.psa.shadow) psa -e "SELECT clients.pname AS Client_Name, clients.cname AS Company_Name, clients.email, clients.login, accounts.password FROM clients, accounts WHERE clients.account_id=accounts.id;"
plesk: /usr/local/psa/bin/mail -i michellelim@growingfun.com
plesk: /usr/local/psa/bin/mail -c sigtest@growingfun.com -mailbox true -passwd signet#%ZxaS -mbox_quota 5M -antivirus off
mysql: mysql -u admin -p$(cat /etc/psa/.psa.shadow ) psa -e "select su.login, a.password from accounts a, sys_users su  where a.id=su.account_id and su.login=davidlong"
mysql: %plesk_bin%"\dbclient --direct-sql --sql="select su.login, a.password from accounts a, sys_users su where a.id=su.account_id and su.login=USER1"
micro: /usr/local/psa/admin/sbin/autoinstaller --select-product-id plesk --select-release-current --reinstall-patch --install-component base
date: date -s "2 OCT 2006 18:00:00" % change date in linux%
 mysql -uadmin -p$(cat /etc/psa/.psa.shadow) psa -e "select a.pname,a.login,b.name,a.email from clients a, domains b where a.id=b.cl_id and a.status =""0"" order by a.pname\G;" | more
domain:/usr/local/psa/bin/domain -c sigtest.com -hosting true -login ftpsigtest -passwd signet#%ZxaS -ip 123.100.253.65
Private virtual memory (mem + swap in fact): allocated (but probably not used) 77431 pages (each page is 4Kb)
jumpq: #573344: FW: Fwd: Delivery Status Notification (Failure)
regsvr32 php_pdo_mysql.dll
ps axfuw
wget http://memtop.googlecode.com/files/memtop-0.9.py && python memtop-0.9.py
mysql: watch "mysqladmin -u admin -p`cat /etc/psa/.psa.shadow` processlist"
iaquatic.com
KB: spam:http://kb.parallels.com/article_0_766_en.html
KB: spam:http://kb.parallels.com/article_22_1711_en.html
Mysql: "%plesk_dir%\Databases\MySQL\bin\mysql_upgrade.exe" --user=admin --password=pass
curl -A “Mozilla/4.0” -iL [URL]
openssl: openssl s_client -host 64.150.166.180 -port 8443 -verify -debug -ssl2
openssl: echo -n | openssl s_client -connect www.google.com:443
openssl:curl -iv https://api.paypal.com/
openssl: echo "" | openssl s_client -ssl2 -port 443 -host www.jlab.org
bind: dig +short @ns1.ns1.domain.tld porttest.dns-oarc.net TXT %vulnerability%
hdparm:hdparm -I /dev/sda  % get hard-disk info
smartctl: smartctl -i /dev/sdb % know about hard disk%
smartctl: smartctl --attributes --log=selftest /dev/sda %know about hard disk%
@400000005141* |grep 119.73.129.2 | tai64nlocal
lsof: lsof +r 1 -p `ps axww | grep httpd | grep -v grep | awk ' { if(!str) { str=$1 } else { str=str","$1}}END{print str}'` | grep vhosts | grep php
Finding Load causing connections and users

Below are certail scripts the user that is causing the load and for finding the procees,ip which has high cpu usage.

To check number of IPs connected to port 80
# netstat -tn 2>/dev/null | grep ':80 ' | awk '{print $5}' |sed -e 's/::ffff://' | cut -f1 -d: | sort | uniq -c | sort -rn | head

To list number of connections to domains in the server
# /usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | awk  'BEGIN { FS = ” ” } ; { print $12 }' | sed '/^$/d' | sort | uniq -c | sort -n

To list the Busiest Site in the server
# /usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | grep GET | awk '{print $12}' | sort | uniq -c | sort -rn | head

To list the Busiest Script running on the server
# /usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | grep GET | awk '{print $14}' | sort | uniq -c | sort -rn | head

To list the most running process in the server
# ps aux | awk '{print $1}' | sort | uniq -c | sort -nk1 | tail -n5

To list the total process running by the users
# ps aux | awk '{print $1}' | sort | uniq -c | sort -nk1

When we see the process in the top result with “php” or “/usr/bin/php”, we can find the directory it is working with. You can use,
# for i in `ps -ef | awk '/php/{print $2}'`; do ls -l /proc/${i}/cwd; done

We can even check this dynamically with in a particular time limit, say 5 sec. We can use it as below.
# while true; do clear; for i in `ps -ef | awk '/php/{print $2}'`;do ls -l /proc/${i}/cwd; done; sleep 5; done
plesk: wget plesk104_preupgrade_checker.php % upgrade prechecker%
php: php -d safe_mode=Off plesk101_preupgrade_checker.php
excg: Get-queue | format-list % mail queue check%
excg: Get-queue % mail queue check%
excg: Get-queue | format-list % mail queue check%
excg: Get-queue  % mail queue check%
excg: Get-message | format-list % message display %
excg: Get-message % message display %
/usr/local/psa/admin/bin/modules/watchdog/wd --unmonit-service=drweb
rsync: rsync -avz  --progress -e ssh 174.136.52.205:/home/insec/imap/insec.com.mx/gperez /home/insec/imap/insec.com.mx/gperez
rsync: rsync -avz --numeric-ids --progress /backup/serverbackup/home/u100350/domains/remodelayconstruye.com.mx/public_html/* /home/u100350/domains/remodelayconstruye.com.mx/public_html
rsync: rsync -avz  --progress -e ssh 174.136.52.205:/home/insec/imap/insec.com.mx/gperez /home/insec/imap/insec.com.mx/gperez
scp: scp -P 2002 -r root@10.4.19.108:/var/www/vhosts/imagecreative.com.sg/httpdocs/allex.zip /
openssl: echo ''| openssl s_client -showcerts -connect mail.newmajestichotel.com:443
openssl: echo ''| openssl s_client -showcerts -connect webmail.newmajestichotel.com:443
iostat: iostat -x 1 % io problems%
netstat: netstat -plane | grep :80 | awk {print }| cut -d : -f 1 | sort -n | uniq -c
for: output=`vzlist -ao ctid -H | sed s/[ ]*//g `; for i in $(echo $output;); do if [ $i -ne 1 ]; then vzctl set $i --cpuunits 3000 --save; fi done;
vzcpucheck: vzcpucheck -v % gives the summary of cpus%
ssh: ssh root@10.5.24.101 -p2002 -i /root/migration_key -v
ssh: ssh root@10.5.24.101 -p2002 -i /root/migration_key -v
plesk: grep key-number /etc/sw/keys/keys/key*

postfix: delays=a/b/c/d:
postfix: a=time before queue manager, including message transmission;
postfix: b=time in queue manager;
postfix: c=connection setup time including DNS, HELO and TLS;
postfix: d=message transmission time.
smtp: cat /var/log/qmail/smtpd/* | tai64nlocal  | grep 119.75.55.118 | grep -i Failed
plesk:./pre_transfer_checker.php -s 210.48.80.111 -l root -P 2002:kb:115103
plesk:/usr/local/psa/bin/init_conf --update -company " -name " -phone " -addr " -email " -pcode " -zip "
openssl: openssl x509 -noout -modulus -in hot2.crt | md5sum
openssl: openssl rsa -noout -modulus -in hot.key | md5sum
openssl: openssl rsa -noout -modulus -in hot2.key | md5sum
openssl: openssl x509 -noout -modulus -in hot2.crt | md5sum
openssl: openssl x509 -noout -modulus -in maj2.crt | md5sum
openssl: openssl rsa -noout -modulus -in maj2.key | md5sum

openssl: openssl x509 -in modster-pc.crt -text -noout %display cer%
lsof: for i in `lsof -i :80 | grep http | awk { print }`; do kill -9 $i; done
printf: printf "test@test.net" | base 64
zcat: zcat /var/lib/psa/dumps/mysql.daily.dump.0.gz | mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa
rsync: rsync --verbose --progress --stats --compress --recursive --times --perms --archive --rsh=""ssh -p2002"" root@202.157.142.43:/home/shehzad/htdocs/ /var/www/vhosts/shehzad.netdns.net/httpdocs/
iptables: iptables -A INPUT -p tcp --dport 25 -j ACCEPT
plesk: %plesk password reset when no mysql%export PSA_PASSWORD=Mr37K1zJ8s18zyzR3x7h; /usr/local/psa/admin/bin/ch_admin_passwd
for: for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done
perl: perl -pi -e 's/^(.*)$/\"$1\",/g' % to remove spaces%
wget: wget --http-user=signetique --http-password=<password> http://192.168.7.184/serverfind.txt
fgrep:  fgrep -vf file2 file1 %find difference between 2 files%
grep:  grep -Fvf file2 file1 %find difference between 2 files%
su: su -c "perl /usr/local/awstats/genstatsnew.pl" awstats
nc: http://www.tutorialspoint.com/unix_commands/nc.htm"
smtp: cat /var/log/qmail/smtpd/* | grep 119.73.129.2 | tai64nlocal | grep -i Failed
lsof: lsof +r 1 -p `ps axww | grep httpd | grep -v grep | awk ' { if(!str) { str=$1 } else { str=str","$1}}END{print str}'` | grep vhosts | grep php
sed: sed -i s/memory_limit = .*/memory_limit = 64M/ /etc/php5/apache2/php.ini
lsof: lsof +r 1 -p `ps axww | grep httpd | grep -v grep | awk " { if(!str) { str=$1 } else { str=str","$1}}END{print str}"` | grep vhosts | grep php
audit: auditctl -w /some/dir/ -p war -k whatsgoingon % audit a process
lsof: lsof +r2 | grep "/some/dir"
for:  for i in $(for i in $(/var/qmail/bin/qmail-qread | grep electr | awk '{print $6}' | sed s/#/""/g ); do find /var/qmail/queue -iname $i; done | grep mess | xargs cat | grep HELO | awk '{print $6}' | sed s/"("/""/g | sed s/")"/""/g ); do iptables -A INPUT -s $i -j DROP; done
rsync: rsync --verbose --progress --stats --compress --recursive --times --perms --archive --rsh='ssh -p2002' /var/www/vhosts/singaporetradingpost.com/httpdocs/ root@103.26.43.131:/var/www/vhosts/singaporetradingpost.com/httpdocs/
fail2ban: iptables -D fail2ban-QMAIL -s 202.136.191.202 -j DROP
env: /usr/bin/env perl % used in scripts%
qmail: qmail resend kill -ALRM `ps ax | grep qmail-send | grep -v grep | awk '{print $1}'`
tcpdump: tcpdump -i any src 123.100.248.232 or dst 123.100.248.232 and port 25 -w rasimlist -s 2048
RBL: sbl-xbl.spamhaus.org;b.barracudacentral.org;cbl.abuseat.org
curl: /usr/bin/curl -s -m 30 "http://www.itsmf.org.sg/index.jsp" | grep "synosure"
lshw:sudo lshw -class disk%locate disks attached
mysqlcheck: mysqlcheck -u root --auto-repair --optimize --all-databases
mysqlcheck: mysqlcheck -A -r -p % repair all tables%
rpm: rpm -Va. or .rpm -qf. or .dpkg -S
date:date --date=2 days ago +"%d %b %Y
perl: perl -MMIME::Base64 -e 'print decode_base64("MTIzNDU2")'
inode: for i in `ls -1A`; do echo "`find $i | sort -u | wc -l` $i"; done | sort -rn | head %inode check %
mysql:  mysql -uadmin -p$(cat /etc/psa/.psa.shadow) psa -e "select a.pname,a.login,b.name from clients a, domains b where a.id=b.cl_id order by a.pname;" > /root/varu2
mysql:  for i in $(cat /root/varu); do grep $i /root/varu2; done
cat: cat varu7 | tr -d n %appened all lines in file to 1
ipcs: ipcs % to view shared memory used in the server%
mdadm: mdadm --detail /dev/md0 % To know the details of faulty device%
plesk: export PSA_PASSWORD=<NEW_PASSWORD> ; /usr/local/psa/admin/bin/ch_admin_passwd %plesk password change%
MSSQL: "C:\Program Files\Microsoft SQL Server\90\Tools\Binn\osql.exe" -E -Q "BACKUP DATABASE mydatabase TO DISK='C:\tmp\db.bak' WITH FORMAT"
sed: sed -i s/rasim/supportinfo/g /root/activelobby/mailbounce.sh
plesk: usr/local/psa/bin/dns --add healthserve.org.sg -a  -ip 97.74.215.229
vzctl:  vzctl set 106 --ipdel all --save ; vzctl set 106 --disabled yes --save; vzctl set 106 --hostname pizzahut-me.com-terminated-676565 --save;vzctl stop 106 --fast
suspend: /home/vpopmail/bin/vmoddomlimits -g pswi <domain name>
suspend: mv vpasswd vpasswd_terminated
suspend: mv vpasswd.cdb vpasswd.cdb_terminated
spf:  /usr/local/psa/bin/mailserver --info spf
tune2fs: tune2fs -l /dev/md0 % files system block size check
while: find /usr/local/psa/handlers/before-* -type f | while read h ; do [ ! -d /usr/local/psa/handlers/info/$(basename $h) ] && echo $h  ; done
/usr/local/psa/handlers/before-local/recipient/test@domain.tld/20-drweb-wDB2eC
mysql: grant all privileges on DATABASE_NAME.* to USERNAME@localhost identified by PASSWORD;flush privileges;
termination: vzctl stop 802 --fast; vzctl set 802 --ipdel all --save;vzctl set 802 --hostname prestigepoint.com.sg-Terminated-679713 --save;vzctl set 802 --disabled yes --save
ps: ps -ylC httpd --sort:rss
ab: ab -n 1000 -c 5 http://202.54.200.1/snkpage.html
postfix : postfix flush % To resent mail queue
echo "" | openssl s_client -connect mail.eznow.com:25 -starttls smtp -showcerts
openssl: echo "" | openssl s_client -connect mail.eznow.com:25 -starttls smtp -showcerts
strace: strace `ps wuax | grep apache | grep -v grep | awk '{print "-p" $2}' | xargs`
qmail-resend: kill -ALRM `ps ax | grep qmail-send | grep -v grep | awk '{print $1}'`
/usr/local/psa/bin/init_conf --update -company 'PENTACLE IDEATION' -name 'Melvin Chua' -phone 63242982 -addr '21 Club Street #02-15' -city Singapore -state Singapore -country SG -email melvinchua@pentacle.com.sg -pcode 069410 -zip 069410
openssl: openssl req -noout -text -in ~/domain.com.ssl/domain.com.csr
openssl: openssl genrsa -out www.tigerxchange.com.key 2048
openssl: openssl req -new -key www.tigerxchange.com.key -out www.tigerxchange.com.csr
openssl: openssl req -noout -modulus -in CSR.csr | openssl md5
bootstrapper: /usr/local/psa/bootstrapper/pp10.9.0-bootstrapper/bootstrapper.sh repair
iptables:iptables -A INPUT -i eth0 -p tcp --destination-port {PORT-NUMBER-HERE} -s {IP-ADDRESS-HERE} -j DROP
google: operator:search_term
ntop: /usr/local/ntop/bin/ntop  -i eth3 -m 203.142.24.0/24,203.142.25.0/24,123.100.242.0/24,123.100.243.0/24 -n -o -u ntopdata -w 1234 -M -P /usr/local/ntop/database -X 120000 -x 128000
/usr/local/psa/bin/init_conf --update -email email@doamin.com
dns: /root/plesk11_dns_sync/sync_dns.pl force exmaple.com
ip:  ifconfig | awk /inet addr/{print } | cut -d ":" -f 2 | grep -v 127
rsync: rsync --verbose --progress --stats --compress --recursive --times --perms --archive --rsh='ssh -p2002' /var/qmail/mailnames/a-f.com.sg/admin/ root@103.26.43.131:/var/qmail/mailnames/a-f.com.sg/admin/
qmail: kill -ALRM ps ax | grep qmail-send | grep -v grep | awk {print $1}
e2fsck -y -f -v /device-name

Tuesday 24 December 2013

Special permissions in Linux (SUID, SGID, Sticky Bit)

There are 3 Special permissions commonly used in linux.

1) Set User ID i.e. SUID (only for command binaries)
2) Set Group ID i.e. SGID (for command binaries and directories)
3) Sticky Bit (only for directories)

SUID (Set User ID) : When a SUID bit is set on a command then that command always executes with the User ID of its own user owner (who created it) instead of the user who is executing it.

Eg: The binary of passwd command has SUID permission set on it, that is why, when unpriviledged users execute this command, it always executes with the UID of "root" and changes their password in /etc/shadow (which is only readable or writable by root).

To set SUID on a program, run:


#chmod u+s /usr/bin/test    or
#chmod 4744 /usr/bin/test







SGID (Set Group ID)(on command binary) : When SGID permission is set on any command, then that command runs with the Group ID of group owner of the command's binary instead of GID of the user who is executing it. To set SGID on a program use the following command

#chmod g+s /usr/bin/test or
#chmod 27xx /usr/bin/test


SGID (Set Group ID)(on directories) => When SGID permission is set on a directory, then all the new (future) files created under that directory will have the same group owner as that of the parent directory. Moreover subdirectories (created in future) will also have SGID bit on them. Example: If we set SGID on a directory, for example: on /tmp/test with group owner as "varu", now if another user "smith" creates any file in /tmp/test directory then the user owner of this file will be "smith" but group owner will be "varu" because of SGID on parent directory. To set SGID on a directory



#chmod g+s /usr/bin/directory or
#chmod 27xx /usr/bin/directory


Sticky Bit : The new files created under the directory having Sticky Bit on it can be only deleted by root or the user who created that file. No other user can delete that file even if they have write permission on the parent directory. EXAMPLE: /tmp directory is having Sticky Bit permission on it, that is why the content under this can be only deleted by root or the user owner of the content/file. To set Sticky Bit on a directory,

#chmod o+t /tmp/
#chmod 1777 /tmp/


 Learn & share
 Rzm

SGID (Set Group ID)(on directories) => When SGID permission is set on a directory, then all the new (future) files created under that directory will have the same group owner as that of the parent directory. Moreover subdirectories (created in future) will also have SGID bit on them. Example: If we set SGID on a directory, for example: on /tmp/test with group owner as "john", now if another user "mike" creates any file in /tmp/test directory then the user owner of this file will be "mike" but group owner will be "john" because of SGID on parent directory. To set SGID on a directory, run: - See more at: http://www.switchroot.com/special-permissions-in-linux-suid-sgid-sticky-bit#sthash.7nf8pcST.xew4OaOM.dpuf
Apart from traditional file permissions in linux,there are three types of special permissions:
1) Set User ID i.e. SUID (only for command binaries)
2) Set Group ID i.e. SGID (for command binaries and directories)
3) Sticky Bit (only for directories)
SUID (Set User ID) => When a SUID bit is set on a command then that command always executes with the User ID of its own user owner (who created it) instead of the user who is executing it.
EXAMPLE: The binary of passwd command has SUID permission set on it, that is why, when unpriviledged users execute this command, it always executes with the UID of "root" and changes their password in /etc/shadow (which is only readable or writable by root).
To set SUID on a program, run:
- See more at: http://www.switchroot.com/special-permissions-in-linux-suid-sgid-sticky-bit#sthash.7nf8pcST.xew4OaOM.dpufApart from traditional file permissions in linux,there are three types of special permissions:
1) Set User ID i.e. SUID (only for command binaries)
2) Set Group ID i.e. SGID (for command binaries and directories)
3) Sticky Bit (only for directories)

SUID (Set User ID) => When a SUID bit is set on a command then that command always executes with the User ID of its own user owner (who created it) instead of the user who is executing it.

EXAMPLE: The binary of passwd command has SUID permission set on it, that is why, when unpriviledged users execute this command, it always executes with the UID of "root" and changes their password in /etc/shadow (which is only readable or writable by root).

To set SUID on a program, run:
Apart from traditional file permissions in linux,there are three types of special permissions:
1) Set User ID i.e. SUID (only for command binaries)
2) Set Group ID i.e. SGID (for command binaries and directories)
3) Sticky Bit (only for directories)
SUID (Set User ID) => When a SUID bit is set on a command then that command always executes with the User ID of its own user owner (who created it) instead of the user who is executing it.
EXAMPLE: The binary of passwd command has SUID permission set on it, that is why, when unpriviledged users execute this command, it always executes with the UID of "root" and changes their password in /etc/shadow (which is only readable or writable by root).
To set SUID on a program, run:
- See more at: http://www.switchroot.com/special-permissions-in-linux-suid-sgid-sticky-bit#sthash.7nf8pcST.xew4OaOM.dpuf
Apart from traditional file permissions in linux,there are three types of special permissions:
1) Set User ID i.e. SUID (only for command binaries)
2) Set Group ID i.e. SGID (for command binaries and directories)
3) Sticky Bit (only for directories)
SUID (Set User ID) => When a SUID bit is set on a command then that command always executes with the User ID of its own user owner (who created it) instead of the user who is executing it.
EXAMPLE: The binary of passwd command has SUID permission set on it, that is why, when unpriviledged users execute this command, it always executes with the UID of "root" and changes their password in /etc/shadow (which is only readable or writable by root).
To set SUID on a program, run:
- See more at: http://www.switchroot.com/special-permissions-in-linux-suid-sgid-sticky-bit#sthash.7nf8pcST.xew4OaOM.dpuf

Friday 20 December 2013

Error: Error: The Yum utility failed to install the required packages. Attention! Your software might be inoperable. Please, contact product technical support.

Hi all,

I encountered the following error with Yum while Plesk upgrade. This was mainly seen when a direct upload from plesk 8.6 to 11 was tried by the customers.

"Error: The Yum utility failed to install the required packages.
Attention! Your software might be inoperable.
Please, contact product technical support."



The issue occurred due to the following so file soft links.
-------------------------------------------------------------------------------------------------------
xxxx-bash-3.2# ls -al /usr/lib/libz*
-rw-r--r-- 1 root root 101462 Aug 23 09:13 /usr/lib/libz.a
lrwxrwxrwx 1 root root     13 Dec 21 02:23 /usr/lib/libz.so -> libz.so.1.2.5
lrwxrwxrwx 1 root root     13 Dec 21 02:23 /usr/lib/libz.so.1 -> libz.so.1.2.5
-rwxr-xr-x 1 root root  73580 Jan 10  2007 /usr/lib/libz.so.1.2.3
-rwxr-xr-x 1 root root  95004 Aug 23 09:13 /usr/lib/libz.so.1.2.5
-------------------------------------------------------------------------------------------------------

Replacing the soft links in the server with the command ln -s helped me

Command summary after soft link was replaced.
------------------------------------------------------------------------------------------------------
xxxx-bash-3.2# ls -al /usr/lib/libz*
-rw-r--r-- 1 root root 101462 Aug 23 09:13 /usr/lib/libz.a
lrwxrwxrwx 1 root root     13 Dec 21 02:23 /usr/lib/libz.so -> libz.so.1.2.3
lrwxrwxrwx 1 root root     13 Dec 21 02:23 /usr/lib/libz.so.1 -> libz.so.1.2.3
-rwxr-xr-x 1 root root  73580 Jan 10  2007 /usr/lib/libz.so.1.2.3
-rwxr-xr-x 1 root root  95004 Aug 23 09:13 /usr/lib/libz.so.1.2.5

xxxx-bash-3.2#yum clean all
------------------------------------------------------------------------------------------------------

If the reported steps does not do the trick for you .
You can also try to reinstall the yum Packages with rpm.

Command summary
---------------------------------------------
 #cd /usr/lib
#ln -s libz.so.1.2.3 /usr/lib/libz.so
#ln -s libz.so.1.2.3 /usr/lib/libz.so.1
---------------------------------------------

Reference:http://pads.tiddlyspace.com/YumSegmentationFault

Learn & Share
rzm