Wednesday, October 20, 2021

How to fix NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32

 Run these commands in the terminal:

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 40976EAF437D05B5
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32

This downloads the missing GPG keys (as mentioned in the original error message) from the Ubuntu GPG keyserver.


You can also add multiple keys with a single command:


apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32 40976EAF437D05B5

How to install SFTPGO on Ubuntu 18.xx and higher

 This is a very quick and easy guide how to install SFTPGO on Ubuntu Server 18.xx or higher:

sudo apt update

sudo apt install software-properties-common



sudo add-apt-repository ppa:sftpgo/sftpgo



sudo apt install sftpgo



sudo systemctl status sftpgo



Then, you can access / use SFTP go from:

http://{whatever your IP}:8080

SFTP port is 2022


Monday, October 11, 2021

How to fix apt-get update GPG "NO PUBKEY" error?

Are you getting the following error when executing 'sudo apt-get update'?

W: GPG error: http://security.ubuntu.com trusty-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32

W: GPG error: http://archive.ubuntu.com trusty-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32

W: GPG error: http://archive.canonical.com trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32

W: GPG error: http://archive.ubuntu.com trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32


Here is how to fix it:

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 40976EAF437D05B5

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32


Then you can continue with:

sudo apt-get update

 

Saturday, November 14, 2020

/opt/eff.org/certbot/venv/bin/python: No module named pip.__main__; 'pip' is a package and cannot be directly executed

 I encountered this error while trying to renew Let's Encrypt Certbot-Auto

/opt/eff.org/certbot/venv/bin/python: No module named pip.__main__; 'pip' is a package and cannot be directly executed

My webserver is using Ubuntu 12.04.3 LTS (precise).

My certbot-auto is located at /data_local/app/cron_shell/lets_encrypt   (yours will be different)

I searched for a solution for 2 hours before finding this one that worked:


STEP 1 - MAKE COPY OF EXISTING CERTBOT-AUTO

cp /data_local/app/cron_shell/lets_encrypt/certbot-auto /data_local/app/cron_shell/lets_encrypt/certbot-auto-20201114


STEP 2 - EDIT THE CONTENTS OF CERTBOT-AUTO

    pip_version = StrictVersion(check_output([python, '-m', 'pip', '--version'])

        TO

    pip_version = StrictVersion(check_output(['pip', '--version'])

- and -

    command = [python, '-m', 'pip', 'install', '--no-index', '--no-deps', '-U']

        TO

    command = ['pip', 'install', '--no-index', '--no-deps', '-U']


STEP 3 - RETRY TO UPGRADE CERTBOT-AUTO
(a regular renew action without -no-upgrade will automatically do upgrade)

/data_local/app/cron_shell/lets_encrypt/certbot-auto renew

Monday, July 27, 2020

Setup Ubuntu Server with Jailed Chroot Access via SSH - restrict SSH, SCP and RSYNC [using rssh]

I have tried to create a FILE TRANSFER only linux server for a few days without success. My initial plan was to create a server which only sftp capability.  I thought by just supporting sftp I can still perform scp and rsync, but I was wrong.  I was able to create the sftp only server quite easily but which doing scp and rsync it rejected the connection with the following error:

This service allows sftp connections only.

Monday, June 1, 2020

[SOLVED] Blocked ports even when UFW disable (inactive) on Ubuntu Desktop 20.04 LTS

This problem stumped me for at least 4 hours and was very frustrating.  Basically I installed a brand new Ubuntu 20.04 Desktop LTS with all its drivers and softwares (full install).  The installation process went flawlessly.

One of the first thing I did was to install XRDP.  I prefer RDP over VNC for its speed and simplicity.  However I immediately hit a wall because the I can not connect to my Ubuntu Desktop via RDP even though I already confirmed the port 3389 is open and listening.

Here is the command you need to use to confirm Linux port is listening:

netstat -tuplen
systemctl status xrdp

Here is the command you need to confirm ports are open and answering:

telnet localhost 3389

All this time I made sure already UFW is disabled by issuing the following command:

ufw disable
ufw status verbose

I had a feeling that firewall or something is blocking, so I tested using SSH Tunnel method.  I confirmed I was able to connect to XRDP via SSH Tunnel.  So that confirmed RDP is working.  It is just the issue with network port blocking somehow.  What made it very strange is that Port 22 (SSH) is not blocked.

I even installed NGINX (webserver) on port 80 and it also was blocked! 

If you are experiencing all of the above issue... you are in luck, here is the solution:

SOLUTION! :

iptables -F


That will flush your IP Chains and that is the single command that solved all my problem above.

I have also rebooted the Ubuntu many times and iptable -F seems to be permanent (persistent).

I hope this helped somehow. 

Thanks for reading!

Saturday, May 16, 2020

[SOLVED] Wordpress Behind Reverse Proxy: Too Many Redirect Error

I have installed a wordpress behind a reverse proxy to conserve IP address and also to simplify SSL certification renewal.

However I have encountered issue with wordpress thinking that it is running on NON-HTTPS while in-fact it is.

To trick wordpress to think it is running in SSL mode, I inserted the following PHP codes on the very top of wp-config.php:


if ( (!empty( $_SERVER['HTTP_X_FORWARDED_HOST'])) ||
     (!empty( $_SERVER['HTTP_X_FORWARDED_FOR'])) ) {
    $_SERVER['HTTPS'] = 'on';
}

I hope this helps somebody. Thanks for reading -LinuxCloudCoder