How to Change the Username of a Linux Account

Linux is a multi-user operating system. Each account on the system has a unique username. This is the name the user uses to log in to the system. It is also the name of the user’s home directory. Every Linux distribution uses the “usermod” command to modify user accounts. This includes changing the user name for a particular account. The “usermod” command can only be used by the root user. The root user can modify every account that accesses the operating system.

Step 1

Click on the main “Applications” or “Programs” menu.

Step 2

Click on the “Terminal” or “Konsole” menu option to open a terminal window and access the command prompt.

Step 3

Type the command “su -” to become the root user. Ubuntu and Linux Mint users type “sudo” before the following command.

Step 4

Type the command “usermod -l new_user login” to change the user name for an account. Replace “new_user” with the new username for the account. Replace “login” with the current username for the account.

Step 5

Type the command “exit” to close the root session.

How to Find UID and GID

The Linux and Unix operating systems use the UID — user ID — to identify a particular user. The GID, or group ID, is used to identify a group. Each user will have a single, unique UID and a primary GID. The user can belong to several secondary groups and each secondary group will have a unique GID. The “id” command can be used to show the UID and GIDs for a particular user. The root (super) user can view the UID and GID for any user. If you do not have root privileges, you can only view your own UID and GID.

Step 1

Open a terminal window. The terminal application is usually found in the “Accessories,” “Utilities” or “Tools” section of the main “Programs” or “Applications” menu.

Step 2

Type the command “su” to become the root user. Skip this step if you do not have root user privileges or want to find the UID or GID for your own account.

Step 3

Type the command “id -u” to find the UID for a particular user. Replace “” with the user’s Unix or Linux username.

Step 4

Type the command “id -g” to find the primary GID for a particular user. Replace “” with the user’s Unix or Linux username.

Step 5

Type the command “id -G” to list all the GIDs for a particular user. Replace “” with the user’s Unix or Linux username.

Step 6

Type the command “exit” to close the root user session.

How to View Linux Login History

Linux is a multi-user operating system, meaning that more than one person can be logged into a computer at the same time. To see the login history of all the computer’s users, use the “last” command in the Linux terminal window. Variations of the “last” command can show you the history of one particular user, or the IP addresses of any computers used to log in from, provided the Linux system can be accessed by remote computers.

Step 1

Open the Linux terminal window. The terminal window can be found under the “System Tools,” “Utilities” or “Accessories” section of the main menu depending on your distribution.

Step 2

Type the “last” in the terminal window and press Enter to see the login history of all users.

Step 3

Type the command “last” in the terminal window, replacing “” with the username for a particular user.

Step 4

Type the command “last -a” to see the login history and the IP addresses of the computers used.

Step 5

Type “exit” and press the Enter key to close the terminal window.

How to disable PHP error logs

By default, PHP errors and warnings generated by your websites are logged in error_log files in the directory where your PHP files are located. The PHP error_log files can grow to a large size.

If you do not need the error_log file you can disable PHP error logging using one of the three ways listed below:

PHP Selector in cPanel — Recommended

  1. Log in to cPanel.
  2. Click Select PHP Version.
  3. Click Switch To PHP Options
  4. Set log_errors to Off
  5. Click Save

.htaccess

  1. Edit .htaccess in your public_html folder
  2. Enter the following code:1php_flag log_errors off
  3. Save the file.

php.ini

  1. Create a new file named php.ini in your public_html folder.
  2. Enter the following code:1log_errors = off
  3. Save the file.

Verify your changes

Create a phpinfo php page to check your settings are active.

Delete existing PHP error_log files

  1. View your webspace using FTP or cPanel File Manager
  2. Select your error_log file
  3. Delete

How to convert MBps to IOPS or calculate IOPS from MB/s

Most SSDs have two speed ratings for reading as well as for writing.  The first rating is the sustained MB/s performance, which is the main marketing most manufacturers use.  The second rating is the 4K Random IOPS performance, which gives a much better idea of how the drive will perform in the real world.  The sustained MB/s rating is the sequential transfer rate the SSD will maintain continuously, such as over a period of 30 seconds.  The 4K Random IOPS on the other hand is how many 4K (4096 byte) operations the drive will handle per second with each block being read or written to a random position.

Usually when a Random 4K IOPS figure is given, it may state that this is at a certain queue depth, such as 4, 16, 32 or 64.  With a queue depth of 4, this means that there are 4 separate threads taking place with the drive, each thread independently running its own transfers.  With the use of Native Command Queuing (NCQ), the SSD can handle these threads simultaneously to improve the overall throughput compared to running a single thread.  While many hard disks use native command queuing to line up read/write operations to minimise seek times between each read/write operation, SSDs can read from and write to multiple NAND cells simultaneously, where as the read/write head in a hard disk can only be in one physical place at any time.
While it is nice to see how many IOPS a drive is capable of, it is also useful to see how this translates into actual throughput or even vice versa.  For example, most benchmark tools such as CrystalDiskMark and AS SSD report the random 4K performance in throughput, i.e. MB/s, while the SSD’s specifications usually rates the 4K performance in IOPS.To see how to translate MBps into IOPS and vice versa, we need to do a little math:

IOPS = (MBps Throughput / KB per IO) * 1024
Or
MBps = (IOPS * KB per IO) / 1024

So let’s say we have an SSD claiming a Random 4K write speed of 20,000 IOPS and it achieves 76.2MB/s in the CrystalDiskMark with the QD32 write test.

To convert the 76.2MB/s to IOPS, we perform the following calculation:

IOPS = (76.2 / 4) * 1024
IOPS = 19.1 * 1024
IOPS = 19,558.4

To see what throughput we need to achieve to match the actual 20,000 IOPS claim, we can perform this calculation in reverse:

MBps = (20,000 * 4) / 1024
MBps = 80,000 / 1024
MBps = 78.125MB/s

Note that each manufacturer uses its own method of coming up with their SSD IOPS ratings.  Besides separate IOPS ratings for read and write speeds, a given SSD can behave quite different depending on the type of data being read or written, as well as the duration this transfer takes place.  For example, an SSD that achieves 5,000 Random 4K IOPS sustained write over a period of 30 seconds may only achieve 1,000 IOPS sustained write over a period of 5 minutes.  For SSDs using the SandForce processor, the compressibility of the data also has an impact, so two benchmark tools may show completely different IOPS readings if one tool sends uncompressible data and the other tool sends highly compressible data and also if one runs the benchmark for longer duration than the other.

🙂

Happy calculating.  

linux command to prevent dos attack by using netstat and iptables

Best you can do , IMO, is to set limits

sudo iptables -A INPUT -m limit --limit 50/minute --limit-burst 200 -j ACCEPT
sudo iptables -A INPUT -j REJECT

For port 80, use

sudo iptables -A INPUT -p tcp --dport 80 -m state --state NEW -m limit --limit 50/minute --limit-burst 200 -j ACCEPT
sudo iptables -A INPUT -m state --state RELATED,ESTABLISHED -m limit --limit 50/second --limit-burst 50 -j ACCEPT
sudo iptables -A INPUT -j REJECT

Problem with phpMyAdmin and PHP 7.2: “Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable”

It’s possible that when you installed phpMyAdmin, the version in the repository (phpMyAdmin v4.6.6) was not fully compatible with PHP 7.2. There is a newer version available on the official website (v4.8 as of writing), which fixes these compatibility issues with PHP 7.2.

sql.lib.php

This error is caused by a line of code in /usr/share/phpmyadmin/libraries/sql.lib.php.

If you don’t want to wait for the repositories to update with the latest version, it is strongly recommended that you manually upgrade to the latest version of phpMyAdmin yourself.

Alternatively, you can make a change to sql.lib.php to temporarily fix the error.

Firstly, backup sql.lib.php before editing.

Firstly, backup sql.lib.php before editing.

sudo cp /usr/share/phpmyadmin/libraries/sql.lib.php /usr/share/phpmyadmin/libraries/sql.lib.php.bak

Edit sql.lib.php in nano.

sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php

Press CTRL + W and search for (count($analyzed_sql_results['select_expr'] == 1)

Replace it with ((count($analyzed_sql_results['select_expr']) == 1)

Save file and exit. (Press CTRL + X, press Y and then press ENTER)

Import/Export issues

If you are also getting an error Warning in ./libraries/plugin_interface.lib.php#551 under import and export tabs:

Backup plugin_interface.lib.php

sudo cp /usr/share/phpmyadmin/libraries/plugin_interface.lib.php /usr/share/phpmyadmin/libraries/plugin_interface.lib.php.bak

Edit plugin_interface.lib.php

sudo nano /usr/share/phpmyadmin/libraries/plugin_interface.lib.php

Press CTRL + W and search for if (! is_null($options) && count($options) > 0) {

If not found, try search for if ($options != null && count($options) > 0)

Replace with if (! is_null($options) && count((array)$options) > 0) {

Save file and exit. (Press CTRL + X, press Y and then press ENTER)

Testing your email with Telnet

These FAQs will teach you how to test your IMAP, POP3 and SMTP settings using Telnet

Simply click on a title below to skip to the most appropriate FAQ. You can also click the Top button to return and make another selection.

  1. How can I use Telnet to test my IMAP e-mail account is working?
  2. How can I use Telnet to test my POP3 e-mail account is working?
  3. How can I use Telnet to test that my email account can send mail via SMTP?

How can I use Telnet to test my IMAP e-mail account is working?

This article explains how to use the telnet command in your command prompt console to establish whether your e-mail account is accepting connections.

In circumstances where your usual e-mail client software is not connecting to your IMAP mailbox, using telnet helps you to perform a basic assessment of whether your mailbox is functional. This can help you to eliminate your local software as an issue in being unable to receive your mail.

Please be aware that for Windows Vista & Windows 7, the telnet function is by default disabled and therefore it must be turned on from the Windows Features menu within the control panel.

  • Step 1 of 2Open up your command console – in most versions of Windows, click Start, then Run, type cmd and hit Enter.
  • Step 2 of 2Enter only the text in bold as shown in the example command box below, hitting Enter at the end of each line.
telnet imap.123-reg.co.uk 143
* OK [CAPABILITY IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT
LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS UIDPLUS LIST-EXTENDED I18NLEVEL=
1 AUTH=PLAIN] ATLAS/WebFusion Mail Server
01 LOGIN username@domain.com password
01 OK [CAPABILITY IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT
LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS UIDPLUS LIST-EXTENDED I18NLEVEL
=1 AUTH=PLAIN] Logged in.

This test will indicate whether or not you are able to connect successfully to your e-mail account. If you are able to connect successfully using Telnet, but not through your regular e-mail client, this suggests the issue may be caused by your local software and you should re-check account settings in your e-mail client in accordance with the vendors help documentation and our e-mail support pages.

If you would like to view all folders within a mailbox you can use the below command when connected via Telnet to the IMAP server.

. list "" "*"

Please note: In the code example above, generic values have been used for the mailbox usernames and passwords.

When testing your e-mail account connection using telnet, please ensure you have the correct e-mail account username and e-mail account password to hand.

How can I use Telnet to test my POP3 e-mail account is working?

This article explains how to use the telnet command in your command prompt console to establish whether your e-mail account is accepting connections.

In circumstances where your usual e-mail client software is not connecting to your POP3 mailbox, using telnet helps you to perform a basic assessment of whether your mailbox is functional. This can help you to eliminate your local software as an issue in being unable to receive your mail.

Please be aware that for Windows Vista & Windows 7, the telnet function is by default disabled and therefore it must be turned on from the Windows Features menu within the control panel.

  • Step 1 of 2Open up your command console – in most versions of Windows, click Start, then Run, type cmd and hit Enter.
  • Step 2 of 2Enter the text as shown in the example command box below, hitting Enter at the end of each line. For each successful command you issue, the server will return the message ‘+OK‘ indicating you should proceed to the next command.
telnet pop.123-reg.co.uk 110
+OK Hello there.
user your-emailmailboxusername
+OK Password required.
pass youremailpassword
+OK logged in.

This test will indicate whether or not you are able to connect successfully to your e-mail account. If you are able to connect successfully using telnet, but not through your regular e-mail client, this suggests the issue may be caused by your local software and you should re-check account settings in your e-mail client in accordance with the vendors help documentation and our e-mail support pages.

Please note: In the code example above, generic values have been used for the mailbox usernames and passwords.

When testing your e-mail account connection using telnet, please ensure you have the correct e-mail account username and e-mail account password to hand.

How can I use Telnet to test that my email account can send mail via SMTP?

This article explains how to use the telnet command in your command prompt console to establish whether your e-mail account can send emails via the the 123 Reg SMTP server.

In circumstances where your usual e-mail client software is not connecting to the 123 Reg SMTP server to send emails, using telnet helps you to perform a basic assessment of whether your email account is functional. This can help you to eliminate your local software as an issue in being unable to send your mail.

Please be aware that for Windows Vista & Windows 7, the telnet function is by default disabled and therefore it must be turned on from the Windows Features menu within the control panel.

  • Step 1 of 2Open up your command console – in most versions of Windows, click Start, then Run, type cmd and hit Enter.
  • Step 2 of 2Enter the text as shown in Bold in the example command box below, hitting Enter at the end of each line. For each successful command you issue, the server a return the message.
telnet smtp.123-reg.co.uk 25
220 mail6.atlas.pipex.net ESMTP Exim 4.71 - "ATLAS SMTP Service" Wed, 13 Jul 201
1 10:47:06 +0100
EHLO smtp.123-reg.co.uk
250-mail6.atlas.pipex.net Hello hns01-fw.internal.gxn.net [195.224.160.13]
250-SIZE 31457280
250-PIPELINING
250-AUTH PLAIN LOGIN
250 HELP
AUTH LOGIN
334 DXNl4gddhbWU3
cwtui3lAcmlja2ljaeFoYewuY2 (Base 64 encoded username)
334 UGFzc3dvcmQ6
YeGjc3ducmE (Base 64 encoded password)
235 Authentication succeeded
MAIL FROM: emailaddress@domain.com
250 OK
RCPT TO: recipent@theirdomain.com
250 Accepted
DATA
354 Enter message, ending with "." on a line by itself
Subject Test using Telnet
.
250 OK id=4Qgw3m-023484q-I5

This test will indicate whether or not you are able to connect successfully to send email from your e-mail account and if you see the statement OK it means the that the email message was sent to the recipient.

what possible reason to hack an app android

*decompiled using automated tools
To avoid such issues, organisations do some obfuscation (hiding) of code using free tools like ProGuard or other commercial tools. This makes decompilation a tough job.
However, a good hacker can even bypass restrictions set up by ProGuard. For this reason large organisations like Google and Facebook use commercial obfuscation tools to keep their code safe.

*Some apps can be easily hacked while some apps are very strictly coded.however there is always a posibility of hacking of the apps .you can easily hack some apps if your mobile is rooted

here are some apps that can easily hack any app

1.lucky patcher

2. hack app data

and if you want to hack something that is locked.then you can hack them by “force stop”ing the app from application settings.with this every lock will be disabled.

If you want to hack paid apps and get them for free then you can just google the app name like this

“Utorrent pro apk “

“asphalt cracked apk”

Complete Web Server Setup(Apache2, php, mysql, phpmyadmin)

$ sudo apt-get update
$ sudo apt-get install apache2
$ sudo ufw app list
$ sudo ufw allow 'Apache Full'
$ sudo ufw status
$ sudo systemctl status apache2
$ hostname -I
$ sudo apt-get install curl

Manage the Apache Process

$ sudo systemctl stop apache2
$ sudo systemctl start apache2
$ sudo systemctl restart apache2
$ sudo systemctl reload apache2
$ sudo systemctl disable apache2
$ sudo systemctl enable apache2

How to install PHP

$ apt-get update
$ apt-get upgrade
$ apt-get install php
$ php -v
$ apt-get install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php
$ apt-cache search --names-only ^php
$ systemctl restart apache2

How To Install MySQL 

$ sudo apt update
$ sudo apt install mysql-server
$ sudo mysql_secure_installation
$ sudo mysql -u root -p
$ sudo systemctl status mysql.service

How To Install and Secure phpMyAdmin 

$ sudo apt update
$ sudo apt install phpmyadmin php-mbstring php-gettext
ON UBUNTU 20
$ sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl

If Error

mysql> UNINSTALL COMPONENT "file://component_validate_password";

After phpmyadmin installation

mysql> INSTALL COMPONENT "file://component_validate_password";
$ sudo phpenmod mbstring
$ sudo systemctl restart apache2

Grant Permissions in MySQL

mysql> GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
mysql> FLUSH PRIVILEGES;

Enabling mod_rewrite

$ sudo nano /etc/apache2/apache2.conf
$ sudo nano /etc/apache2/sites-available/000-default.conf


<Directory /home/ubuntu/public_html/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>


$ sudo a2enmod rewrite
$ sudo systemctl restart apache2

Install and Secure Redis on Ubuntu 18.04

$ sudo apt update
$ sudo apt install redis-server
$ sudo nano /etc/redis/redis.conf
$ sudo systemctl restart redis.service

Testing Redis

$ sudo systemctl status redis
Note: This setting is desirable for many common use cases of Redis. If, however, you prefer to start up Redis manually every time your server boots, you can configure this with the following command:

$ sudo systemctl disable redis
$ redis-cli
127.0.0.1:6379> ping
127.0.0.1:6379> set test "It's working!"
127.0.0.1:6379> get test
127.0.0.1:6379> exit
$ sudo systemctl restart redis

enable/disable site in ubuntu

a2ensite, a2dissite - enable or disable an apache2 site / virtual host

DESCRIPTION

This manual page documents briefly the a2ensite and a2dissite commands.

       a2ensite  is  a  script  that  enables  the specified site (which contains a <VirtualHost>
       block) within the apache2  configuration.   It  does  this  by  creating  symlinks  within
       /etc/apache2/sites-enabled.   Likewise,  a2dissite  disables  a  site  by  removing  those
       symlinks.  It is not an error to enable a site which is already enabled, or to disable one
       which is already disabled.

       Apache  treats the very first virtual host enabled specially as every request not matching
       any actual directive is being redirected there. Thus it should be  called  000-default  in
       order to sort before the remaining hosts to be loaded first.

OPTIONS

 -q, --quiet
              Don't show informative messages.

       -m, --maintmode
              Enables  the  maintainer  mode,  that  is  the  program  invocation  is effectuated
              automatically by a maintainer script. This switch should not be used by end users.

       -p, --purge
              When disabling a module, purge all traces of the module in the internal state  data
              base.

EXIT STATUS

       a2ensite  and  a2dissite  exit with status 0 if all sites are processed successfully, 1 if
       errors occur, 2 if an invalid option was used.

EXAMPLES

              a2dissite 000-default

       Disables the default site.

FOR Enable SSL Module 

 sudo a2enmod ssl
 sudo a2ensite default-ssl 

FILES

       /etc/apache2/sites-available
              Directory with files giving information on available sites.

       /etc/apache2/sites-enabled
              Directory with links to the files in sites-available for enabled sites.

header set not working in ubuntu

$ sudo a2enmod headers
$ sudo service apache2 reload

after that write bellow config in your .htaccess file


 Header set X-XSS-Protection "1; mode=block"
  Header set X-Content-Type-Options nosniff