Adding a group in Linux with addgroup

addgroup linux commanhd allow you to create a group. addgroup [options] [–gid ID] group Example root@ok:~# addgroup sokadmin Adding group `sokadmin’ (GID 1004) … Done. root@ok:~# Add a system group (normally group id below 500, run addgroup –system [options] [–gid ID] group

PCI COMPLIANCE SSH Diffie-Hellman Modulus

When doing PCI COMPLIANCE scan got error related to SSH Diffie-Hellman Modulus /etc/ssh/moduli Edit file vi /etc/ssh/sshd_config Add at end of the file KexAlgorithms ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256 Restart sshd systemctl restart sshd

locate command on Linux

locate command find files on a linux server. To install locate, run On CentOS yum install mlocate On Debian/Ubuntu apt install mlocate locate searches through a static index of files. This is rebuild daily using cronjob. You can manually update it by running updatedb

ack better grep for programmers

ack is a tool like grep optimized for programmers. ack show the matched files name only On Debian/Ubuntu, you can install it with apt apt install ack To install from source, run curl https://beyondgrep.com/ack-v3.0.2 > /usr/local/bin/ack && chmod 0755 /usr/local/bin/ack For installing for just one user, run curl https://beyondgrep.com/ack-v3.0.2 > ~/bin/ack && chmod 0755 ~/bin/ack … Read more

log

Logging Linux Commands for all usersMonitor Apache site traffic with ApachetopFind IP with Most Access from Apache LogApache LogFormat show full domain nameDisplay real time statistics with LogtopCpanel find recently logged in usersHow to get list of User-Agent from access log Find the most requested pages To view the most used User Agents Check if … Read more

Monitor Apache site traffic with Apachetop

apachetop is a command line tool like top, that shows traffic on a web site. It used apache access log to show th stats. This will be useful to monitor a web sites traffic in real time. cd /usr/local/src wget https://github.com/HostOnNet/apachetop/archive/master.zip unzip master.zip cd apachetop-master ./configure –with-logfile=/var/log/httpd/access_log make make install If you need to set … Read more

Resize a linux file system with resize2fs

On cloud servers, once you upgrade disk, you will need to resize the filesystem. On Linux ext4 file system, you can do this with command resize2fs. To resize filesystem on /dev/sdb, run root@leonestage:~# resize2fs /dev/sdb resize2fs 1.44.1 (24-Mar-2018) Filesystem at /dev/sdb is mounted on /mnt/HC_Volume_2899894; on-line resizing required old_desc_blocks = 2, new_desc_blocks = 3 The … Read more

Plesk move vhosts folder

Plesk use /var/www/vhosts folder to store sites. On some servers this folder will be on smaller partition. Say you have all disk space on partition /home, in such cause, you can use following command to move web site files to /home folder with following command. plesk bin transvhosts.pl –dest-dir /home/ –correct-scripts /home/ = you can … Read more

Bandwidth Limit on rsync

I wanted to transfer some files between two computers, but don’t want to use all bandwidth available on the network as it will affect other users on the network. To limit bandwidth, use –bwlimit Option. rsync -avzP –bwlimit=1500 /mnt/data/learn/css/BootStrap3/ root@192.168.1.8:/home/php-tutorial/BootStrap3/ Here –bwlimit=1500 will limit bandwidth usage to 1.5 MB/s. See rsync

Install x11vnc on Ubuntu

To install x11vnc on Debian/Ubuntu, run apt install -y x11vnc To start vnc server, run x11vnc -display :0 By default, there will be no password. To set password, run x11vnc -storepasswd To start x11vnc server with password, run x11vnc -rfbauth ~/.vnc/passwd