April 2025
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
282930  

Categories

April 2025
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
282930  

expect,sshpass,pash

expect,sshpass,pash rpm -qa expect

yum install expect -y

useradd mohan

echo 123456|passwd –stdin mohan

su – mohan

ssh-keygen -t dsa -P ” -f ~/.ssh/id_dsa >/dev/null 2>&1

yum install lrzsz -y

cat mohan_sshkey.exp #!/usr/bin/expect if { $argc !=2 } { send_user “usage: expect mohan_sshkey.exp file host\n” exit } […]

expect,sshpass,pash

expect,sshpass,pash rpm -qa expect

yum install expect -y

useradd mohan

echo 123456|passwd –stdin mohan

su – mohan

ssh-keygen -t dsa -P ” -f ~/.ssh/id_dsa >/dev/null 2>&1

yum install lrzsz -y

cat mohan_sshkey.exp #!/usr/bin/expect if { $argc !=2 } { send_user “usage: expect mohan_sshkey.exp file host\n” exit } #define var set file [lindex $argv 0] set […]

pvresize command

Resolution

pvresize is a tool to resize Physical Volume which may already be in a volume group and have active logical volumes allocated on it.

Expand the PV on /dev/sda1 after enlarging the partition with fdisk:

pvresize /dev/sda1

Shrink the PV on /dev/sda1 prior to shrinking the partition with fdisk (ensure that the PV size […]

SSH vulnerabilities: HMAC algorithms and CBC ciphers

e defaults in the various RHEL version differ and the current default can be found in manual page for sshd_config. For example RHEL6:

The default is: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128, aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc, aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se

You can remove the CBC ciphers by adding the line for RHEL7:

Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,arcfour

The line for RHEL6:

Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,arcfour

The line for RHEL5 (note the […]

Changing temporary directory for sort – bash

I was sorting a very big file using Linux sort command and unfortunately the sort failed as there was not enough space on my /tmp directory.

$ sort -t “|” -k5 ka.log.32323112.out > ka.log.32323112.out sort: /tmp/sort1928700448: write error: No space left on device

just to mention, sort by default uses /tmp for temporaries.

So, how […]

find large files on Linux

Find large files on Fedora / CentOS / RHEL

Search for big files (50MB or more) on your current directory:

find ./ -type f -size +50000k -exec ls -lh {} ; | awk ‘{ print $9 “: ” $5 }’

Output:

[root@my.server.com:~]pwd /home [root@my.server.com:~]find . -type f -size +50000k -exec ls -lh {} ; | […]

Samba in CentOS 6.8 as Secondary DC with Microsoft Active Directory 2012R2

1 . https://bugzilla.samba.org/show_bug.cgi?id=10265 It’s necessary to manually lower the domain and forest functional levels on the Windows 2012 server first, via Powershell: Set-ADForestMode -Identity “mydom.local” -ForestMode Windows2008R2Forest Set-ADDomainMode -Identity “mydom.local” -DomainMode Windows2008R2Domain 2. Need a fresh installed minimal CentOS 6.x OS . Disable SELinux and firewall . Update software packages . Please check above notes […]

grubby fatal error: unable to find a suitable template

grubby fatal error: unable to find a suitable template

Updating : selinux-policy-3.7.19-292.el6_8.3.noarch 8/28 Updating : selinux-policy-targeted-3.7.19-292.el6_8.3.noarch 9/28 Installing : kernel-2.6.32-642.15.1.el6.x86_64 10/28 grubby fatal error: unable to find a suitable template Updating : ntp-4.2.6p5-10.el6.centos.2.x86_64 11/28 Updating : libtiff-3.9.4-21.el6_8.x86_64 12/28 Updating : kernel-headers-2.6.32-642.15.1.el6.x86_64 13/28 Updating : tzdata-2017a-1.el6.noarch 14/28 Cleanup : kernel-2.6.32-573.26.1.el6.x86_64 15/28 warning: erase unlink of /lib/modules/2.6.32-573.26.1.el6.x86_64/weak-updates […]

sshd debug

1. To run sshd in debug mode as a one time instance without affecting other users: # /usr/sbin/sshd -ddd -D -p (port) 2>&1 | awk ‘{ print strftime(“%T: “), $0; fflush(); }’ | tee sshd.log 2. On the client end run add -p (port) to the ssh command line # ssh -p (port)

OR

[…]

Disable Password Authentication for SSH

How to Disable Password Authentication for SSH

Once you have SSH Keys configured, you can add some extra security to your server by disabling password authentication for SSH. (Note that if you do lose your private key, this will make the server inaccessible and you will need to contact HostGator to have this re-enabled.)

To […]