Linux Resources

====Creating group/user and setting permissions====

*(root) Using the {UID}, {GID}, and {VMNAME} from the [[DST UID/GID Documentation]] document, create the local group and user account. The { and } are used to delineate the variable names, and should not be included in the executed command.
 groupadd -g {GID} {VMNAME}
 useradd -u {UID} -g {VMNAME} -G {VMNAME} -c "{VMNAME} Application User" -d /pae/{VMNAME}/home {VMNAME}
 chown {VMNAME}:{VMNAME} /pae/{VMNAME}

*(root) Set an initial password for the newly created user account. This is usually set to a well-known generic password, for the initial install.
 passwd {VMNAME}

===================================

This will report the percentage of memory in use

free | grep Mem | awk '{print $3/$2 * 100.0}'


mount.nfs: Input/output error

mount -o nolock /mnt/ftp


SMTP Test

Telnet
>set LocalEcho
>open mailrelay.jmfamily.com 25
>helo me
??

Passwordless SSH
##################


First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:
a@A:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa): 
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A
Now use ssh to create a directory ~/.ssh as user b on B. (The directory may already exist, which is fine):
a@A:~> ssh b@B mkdir -p .ssh
b@B's password: 
Finally append a's new public key to b@B:.ssh/authorized_keys and enter b's password one last time:
a@A:~> cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
b@B's password: 
From now on you can log into B as b from A as a without password:
a@A:~> ssh b@B
A note from one of our readers: Depending on your version of SSH you might also have to do the following changes:
  • Put the public key in .ssh/authorized_keys2
  • Change the permissions of .ssh to 700
  • Change the permissions of .ssh/authorized_keys2 to 640









for H in alvdstlwls003aq alvdstlwls004aq alvdstlwls005aq ; do echo $H ; ssh $H free 2>/dev/null ; printf "\n\n" ; done

Disable IPV6


Open your modprob.conf file (Red Hat / CentOS / Fedora and friend) and add following line:
vi /etc/modprobe.conf
Add following line:
alias net-pf-10 off
===================================

Search commands


        find / -exec grep "bb-network.sh" '{}' \; -print

        find . -name "*.properties"

######################################
sed replace word / string syntax
######################################

sed -i 's/old-word/new-word/g' *.txt
sed -i 's/du114x01/dt114x01/g' *.xml
find ./ -type f -exec sed -i 's/pdstuldbo11001a.asp.datascantech.com/pdstuldbo11001a.asp.datascantech.com/' {} \;
find ./ -type f -exec sed -i 's/du114x01/dt114x01/g' {} \;


Find out who is monopolizing or eating the CPUs
######################################

ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10


Fetch IPAddress
###############


netstat -tlnp 2>/dev/null | awk '/:80 */ {split($NF,a,"/"); print a[1]}'

VMotion
##################


Vmotion is moving a vm from one environment to another.
[root@pdstdvvivmw001b ALVDSTLTRN001AD]# scp /vmfs/volumes/T1_B_VM_402/ALVDSTLTRN001AD/* root@alpsjmscvmwp01.corp.jmfamily.com:/vmfs/volumes/T1_C_VM_10AC/ALVJMSLTRN001AP/
ALVDSTLTRN001AD-flat.vmdk                                                                                                   100%   30GB   9.6MB/s   53:37
ALVDSTLTRN001AD.nvram                                                                                                       100% 8684     8.5KB/s   00:00
ALVDSTLTRN001AD.vmdk                                                                                                        100%  480     0.5KB/s   00:00
ALVDSTLTRN001AD.vmsd                                                                                                        100%    0     0.0KB/s   00:00
ALVDSTLTRN001AD.vmx                                                                                                          100% 3026     3.0KB/s   00:00
ALVDSTLTRN001AD.vmxf                                                                                                         100%  270     0.3KB/s   00:00

TCPDUMP

#########


[root@alvdstlapa101ad haproxy]# tcpdump -n -i eth0 host 10.29.107.67
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
13:43:39.525347 IP 10.28.65.102.21731 > 10.29.107.67.wap-wsp-wtp: Flags [S], seq 1763534899, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 5], length 0
13:43:39.525984 IP 10.29.107.67.wap-wsp-wtp > 10.28.65.102.21731: Flags [S.], seq 179004262, ack 1763534900, win 5840, options [mss 1380,nop,nop,sackOK,nop,wscale 5], length 0
13:43:39.525994 IP 10.28.65.102.21731 > 10.29.107.67.wap-wsp-wtp: Flags [.], ack 1, win 457, length 0
13:43:39.526013 IP 10.28.65.102.21731 > 10.29.107.67.wap-wsp-wtp: Flags [P.], seq 1:591, ack 1, win 457, length 590
13:43:39.526487 IP 10.29.107.67.wap-wsp-wtp > 10.28.65.102.21731: Flags [.], ack 591, win 220, length 0
13:44:39.528162 IP 10.28.65.102.21731 > 10.29.107.67.wap-wsp-wtp: Flags [R.], seq 591, ack 1, win 457, length 0

DIRTY PAGE RATIO

Cause: Massive writes causing VM to go unresponsive.

Resolution:

Change the dirty pages ratio (from 40% to 10%), which will cause the system to flush dirty pages to disk more often, rather than waiting for 40% of memory (~25GB) to be dirty and then flush to disk. This should prevent those massive writes from causing the VM to go unresponsive. The change will also take effect on reboot.

[root@<SERVER_NAME>log]# cat /proc/sys/vm/dirty_ratio
40

[root@SERVER_NAME log]# echo 10 > /proc/sys/vm/dirty_ratio

[root@SERVER_NAME log]# cat /proc/sys/vm/dirty_ratio
10

[root@SERVER_NAME log]# printf "\n# Decrease dirty page ratio\nvm.dirty_ratio=10\n" >>/etc/sysctl.conf

 

To generate a Encrypted Password:
---------------------------------

$grub-crypt --sha-512
Password:
Retype password:
$6$XCeMOYGN/BjKOdpX$mBMpcWbz3jGXvwvMFYfobFmf1fv6q3QyfV/M9g0Mb2yH8S.ZK3tToavrdoASJiPMZANNGktLlv1nsuglhroNq/

No comments:

Post a Comment