≡ Menu

UNIX

How to log real user’s IP address with Nginx in log files

My nginx server is behind a reverse proxy load balancer. How can I show the correct client IP address in nginx log files when nginx is behind a load balancer?
[click to continue…]

I configured and use my openssh server to accept only public key based authentication. I need to test if my server accepting password. How to allow ssh client to use only password auth when pubkey auth configured?
[click to continue…]

How to copy a single file to multiple directories in Linux or Unix

If I want to copy a single file into three locations (directories), by using a single cp command (e.g. cp file /dir1/ /dir2/ /dir3/. Would that be possible? If yes, please provide the command for GNU/Linux or Unix operating systems.
[click to continue…]

How to fix: MacOS keep asking passphrase for ssh key after upgrade or reboots

I recently upgraded my MacOS Sierra and now ssh command keep asking for passphrase as follows when I try to login to my remote Linux/Unix server:
      Enter passphrase for key ‘/Users/vivek/.ssh/id_ed25519’:
How do I fix MacOS Sierra upgrade that keep breaking ssh keys in terminal?
[click to continue…]

How to check the file size in Linux/Unix bash shell scripting

I am a new bash shell scripting user. How do I find out the size of a file in my bash shell script and store this file size in a bash shell variable?
[click to continue…]

Linux / Unix: “-bash: python: command not found” error and solution

I am a new user and trying to run Python program. I have a cloud based VM/VPS and when I type python mycode.py at the terminal of my server, I get the following error:
-bash: python: command not found

How do I solve this problem?
[click to continue…]

Change Shell To Bash

How do I switch from a ksh shell to bash on Linux or Unix system? How to change shells on Unix-like system?
[click to continue…]

How to secure MongoDB on Linux or Unix production server

MongoDB ransom attacks are in Wild. I am using it for storing data on my public facing cloud server powered by Ubuntu Linux. How do I protect and secure my MongoDB nosql server on Linux or Unix operating system?
[click to continue…]

How to change the ssh port on Linux or Unix server

I am a new Linux/Unix server admin. How do I change the SSH Port for my Linux or Unix server using command line option?
[click to continue…]

How to assign a grep command value to a variable in Linux/Unix

How do I store grep command output in shell variable? What is the syntax to store the command output into a variable in Linux or Unix?
[click to continue…]