Yum Errors

[Errno 14] HTTP/HTTPS Error 404

[Errno 14] PYCURL ERROR 22 – “The requested URL returned error: 403”

[Errno 14] Error 60 – It was impossible to connect to the CentOS servers

Summary

When trying to install or update packages using yum on client systems, yum is failing with one of the following errors:

[Errno 14] HTTP Error 404: Not Found
[Errno 14] HTTPS Error 404 - Not Found
[Errno 14] HTTP Error 404: Status 404
[Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 403"
[Errno 14] Error 60 - It was impossible to connect to the CentOS servers

Leading Causes

1. You are not connected to the internet.

2. This issue can also occur if the system is able to communicate with given server but could not find or access the requested package or path on the server.

3. You have a misconfigured proxy server.

Fixes

1. Validate the system can see things on the internet.

2. This issue can also occur due to corruption of the local machine cache, try to clear cache on system:

yum clean all 
rm -rf /var/cache/yum/*

3. If you have a proxy server, validate it is configured properly in /etc/yum.conf. Here is an example (your names, passwords, and port numbers will obviously be different).

proxy=http://mystuff.mydomain.com:1234
# Account details for yum connections
proxy_username=proxy-user
proxy_password=proxy-password

If that does not work or if you still need help, try one of our community help platforms:

Setup sftp user

List of user’s group
# groups username

# adduser username -g sftp -s /sbin/nologin
# passwd username

in general to add a new group

# groupadd

in general to add user to a group

#usermod -G group username

Open and add the following lines to /etc/ssh/sshd_config configuration file:

list of groups and its users
#  cat /etc/group

Subsystem sftp internal-sftp
 
   Match Group sftp
   ChrootDirectory /home/%u
   ForceCommand internal-sftp
   X11Forwarding no
   AllowTcpForwarding no

# systemctl restart sshd
OR
# service sshd restart

then check the user home directory permissions
# ls /home/ -ltra
in case run this
# chmod 755 /home/username/
# chown root:sftp /home/username/ -Rf
# chown username:sftp /home/username/basedir

I had this error when I tried to create folder in basedir:
mkdir /New directory: permission denied

after googlig a lot I found this here (Thanks):
# setsebool -P ssh_chroot_rw_homedirs on
# restorecon -R /home/username
After this, sftp works as expected, even when chrooted, without having to disable SELinux completely.

——other explanation——

This tutorial will help you to create SFTP only user (without ssh access) on CentOS and RedHat systems. The user can connect the server with SFTP access only and allowed to access the specified directory. User can’t SSH into the server. Follow the below tutorial to create sftp only account.

Step 1 – Create Account

First of all, create a user account to use for sftp access. Below command will create user named sftpuser with no shell access.

sudo adduser --shell /bin/false sftpuser
sudo passwd sftpuser

Step 2 – Create Directory

Now, create the directory structure to be accessible by sftp user.

sudo mkdir -p /var/sftp/files

Change the ownership of the files directory to sftp user. So that sftpuser can read and write on this directory.

sudo chown sftpuser:sftpuser /var/sftp/files

And set the owner and group owner of the /var/sftp to root. The root user has read/write access on this access. Group member and other account have only read and execute permissions.

sudo chown root:root /var/sftp
sudo chmod 755 /var/sftp

Step 3 – Configure SSH for SFTP

Now edit the SSH configuration file in a text editor

sudo vim /etc/ssh/sshd_config

and add the following settings at end of file.

Match User sftpuser
	ForceCommand internal-sftp
	PasswordAuthentication yes
	ChrootDirectory /var/sftp
	PermitTunnel no
	AllowAgentForwarding no
	AllowTcpForwarding no
	X11Forwarding no

Save the configuration and restart SSH service to apply changes.

sudo systemctl restart sshd.service

Verify List All Installed Packages in RHEL, CentOS and Fedora

yum list installed

3. Using YUM-Utils

Yum-utils is an assortment of tools and programs for managing yum repositories, installing debug packages, source packages, extended information from repositories and administration.

To install it, run the command below as root, otherwise, use sudo command:

# yum update && yum install yum-utils

Once you have it installed, type the repoquery command below to list all installed packages on your system:

# repoquery -a --installed 

Repoquery - List All Installed Packages

Repoquery – List All Installed Packages

To list installed packages from a particular repository, use the yumdb program in the form below:

# yumdb search from_repo base

List All Installed Packages from Repository

List All Installed Packages from Repository

Unban ip Failban

Step 1: Find IP Address to Unblock

Log in to your server via SSH and type in the following command:

iptables -L -n

Look for the IP address you want to unblock / unban.

Step 2: Get Jail Name of fail2ban Blocked IP Address

Now we must find the jail name this IP address is in. To do so, type the following to find the jail list settings:

fail2ban-client status

Step 3: Unban IP Address from fail2ban

For this example, we will remove an IP address jailed within ssh. To do so, type in the following:

fail2ban-client set <jail-name> unbanip 123.123.123.123

The IP address should now be unbanned from fail2ban.

fail2ban-client set apache-auth unbanip 83.99.83.189
fail2ban-client set apache-badbots unbanip 83.99.83.189
fail2ban-client set apache-botsearch unbanip 83.99.83.189
fail2ban-client set apache-modsecurity unbanip 83.99.83.189
fail2ban-client set apache-nohome unbanip 83.99.83.189
fail2ban-client set apache-overflows unbanip 83.99.83.189
fail2ban-client set apache-shellshock unbanip 83.99.83.189
fail2ban-client set courier-auth unbanip 83.99.83.189
fail2ban-client set courier-smtp unbanip 83.99.83.189
fail2ban-client set cyrus-imap unbanip 83.99.83.189
fail2ban-client set dovecot unbanip 83.99.83.189
fail2ban-client set dropbear unbanip 83.99.83.189
fail2ban-client set drupal-auth unbanip 83.99.83.189
fail2ban-client set ispconfig unbanip 83.99.83.189
fail2ban-client set php-url-fopen unbanip 83.99.83.189
fail2ban-client set postfix unbanip 83.99.83.189
fail2ban-client set postfix-rbl unbanip 83.99.83.189
fail2ban-client set postfix-sasl unbanip 83.99.83.189
fail2ban-client set pure-ftpd unbanip 83.99.83.189
fail2ban-client set recidive unbanip 83.99.83.189
fail2ban-client set roundcube-auth unbanip 83.99.83.189
fail2ban-client set selinux-ssh unbanip 83.99.83.189
fail2ban-client set sendmail-auth unbanip 83.99.83.189
fail2ban-client set sendmail-reject unbanip 83.99.83.189
fail2ban-client set sshd unbanip 83.99.83.189
fail2ban-client set sshd-ddos unbanip 83.99.83.189
fail2ban-client set wordpress unbanip 83.99.83.189

OR

iptables -L f2b-recidive -n | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | grep -v 0.0.0.0 | xargs -n 1 fail2ban-client set recidive unbanip