Linux / Unix Q & A and HowTos For New Users

Easy to follow Linux, macOS, *BSD, and Unix-like tutorial {Q & A} for developers and sysadmins. You can get the latest tutorial using the RSS/XML feed or weekly newsletter.

See all GNU/Linux related FAQ
AWS offers various instance types, and sometimes, you need to know which one you are using or which one has been deployed by someone else (another developer or sysadmin) for a project. Don’t worry. Here are some commands to find the EC2 instance type over SSH without logging into the AWS console. These commands works with any Linux distro or FreeBSD Unix systems.
[continue reading…]

See all GNU/Linux related FAQ
vnStat is a network traffic monitor for Linux and Unix-like systems. It logs network traffic at different intervals and doesn’t require root permissions to run. The implementation involves two commands: vnstat for querying traffic information and vnstatd for data retrieval and storage. Let’s see how to add a network interface to vnstat after installation for monitoring purposes.
[continue reading…]

See all UNIX related articles/faq
I‘m trying to login using ssh keys but server is only allows to login me using a password. The following message is logged into my Linux or Unix server /var/log/secure or /var/log/auth.log file:

Feb 25 06:36:50 ns5 sshd[26681]: Authentication refused: bad ownership or modes for file /home/user/.ssh/authorized_keys2

Here is another message:

May 24 18:28:35 ls-www-1 sshd[531320]: Connection closed by 18.1.2.3 port 43640 [preauth]
May 24 18:28:44 ls-www-1 sshd[531322]: Authentication refused: bad ownership or modes for file /home/admin/.ssh/authorized_keys
May 24 18:28:44 ls-www-1 sshd[531322]: Connection closed by authenticating user admin 18.1.2.3 port 43650 [preauth]

How do I fix this problem?
[continue reading…]

See all Debian/Ubuntu Linux related FAQ
In Debian and Ubuntu Linux, an “rc” status package means the package has been uninstalled, but its configuration files remain on the disk and take up space. Sometimes, certain directories are also in the /var/ directory. When you type the sudo apt remove pkg1 command, it deletes most of the data, but config files are left alone in case you reinstall that package again. You can free up disk space by removing unwanted config files.
[continue reading…]

See all GNU/Linux related FAQ
Sometimes, you may need to temporarily disable IPv6 in the Linux using net.ipv6.conf.all.disable_ipv6 kernel variable for testing purposes. You can use the sysctl command to turn IPv6 connectivity on or off without rebooting the system. For example, observe how your app or network reacts when IPv6 connectivity is suddenly lost and only IPv4 is available.
[continue reading…]