‘mvwin_wchnstr’ was not declared in this scope when compiling lnav

lnav is a great log file viewer. To use its latest features, we need to fetch the source code and compile manually.
When compiling lnav using make, following error is appeared

I have installed all requirements stated in documentation.

Solution

The lnav documentation only said ncurses library is needed, but not mention which version.
My current installed ncurses library is libncurses5-dev. Changing to libncursesw5-dev fixed this issue.

(This command is for apt package manager, please change to corresponding command according to the package manager you use.)

SFTP ls command returns no files

I created a new user called phone for the client, and created a new directory /home/phone as his home directory. Next create some files for testing purpose.

Then modify /etc/ssh/sshd_config to set chroot configuration

But logging in with this new user and run ls command, no files are listed, it returns nothing.. But if I run ls in ssh, the files are shown.

After trying lots of time, the reason is found: It's because there is no "x" permission for /home/phone directory..

What is "x" permission?

The "x" permission for directory is used to traverse directory. And the "x" permission for file is for file execution.

Then run following command to add "x" permission for /home/phone

And try running ls command in sftp again, the issue is fixed now, we can see files are listed now.

SSH WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

My cloud server moved to VPC from classic network just now, and connecting to it via SSH got following error

 

Solution

It seems the server host key is changed, one way to solve this prolem is to remove the line containing server IP address from /root/.ssh/known_hosts . Then connect to it by SSH again, it will ask you whether trust this new host key, like following message

Type yes and press Enter key, this new host key is added to .ssh/known_hosts  then.

 

Also you can obtain the host key from the remote server, and add it to .ssh/known_hosts  manually , but we won't cover this method in detail.

GitLab took too much memory

The gitlab execution on our company internal server eats lots of memory, the server has 32G memory, and gitlab took more than half of it.

 

I found there are lots of unicorn processes running, and each unicorn process is taking 1.5% memory
In top  command output it's displaying as ruby process and took nearly 500MB resident memory (by default top is sorting by cpu usage, pressing < or > key to change sorting column)
Running above command outputs 34, that means at most 34 unicorn processes are running (some other processes' name also contain unicorn)..
Assume there are 30 real unicorn process running, each takes 500MB memory, then they will take 30*500MB=15GB memory
To decrease unicorn processes count, edit /etc/gitlab/gitlab.rb, and uncomment following line

 

Next restart GitLab

Now the memory usage is decreased.

 

(Note that running gitlab-ctl reconfigure  will not kill already running unicorn processes)

CentOS 6 Install netcat

Netcat is one utility in NMap toolset, it maybe named as nc, ncat or netcat on different Linux distributions. (It's ncat on CentOS 6).

On CentOS 6 netcat is not installed by default, to install it we can run following command

 

Then run following command to check netcat is installed correctly

 

Docker SSH set password not working

First run passwd  command to change the password, after inputting new password, following output is shown.

passwd: password updated successfully

I bind docker port 22 to host port 33333, then running following command to connect to it using ssh with the new password we set earlier

After inputing password, following error is appeared

Permission denied, please try again.

SSH logs from /var/log/auth.log

Solution

To fix this issue, change /etc/ssh/sshd_config

to

Restart sshd and connect to it again, it should work now.