Bobcares

curl 9 Server denied you to change to the given directory

by | Feb 1, 2021

curl 9 Server denied you to change to the given directory occurs when we are denied access to the resource given in the URL.

As part of our Server Management Services, we assist our customers with several such errors.

Today, let us see an effective solution in order to fix this error.

 

curl 9 Server denied you to change to the given directory

One of our customers came across this error while trying to import some VMs into OVM. On checking the issue we found that this error occurs when we are denied access to the resource given in the URL.

Similarly, if we try to FTP to one of the servers and change the remote directory it could lead us to this error.

Since the error was very explicit ‘Server denied you to change to the given directory,’ it has nothing to do with CURL. It is simply an access issue. Adding a username and password can resolve the issue.

It does not work with curl, as curl uses a standard FTP process, which requires a login before changing the relevant directory. However, since there is no automatic directory redirection it works fine on the browser.

The following is the command we use:

curl -v “ftp://root:blahroot@192.168.8.172/var/tmp/x.html”

Since the pathname is relative, rather than absolute the directory misunderstands as /root/var/tmp which does not exist.

To give an absolute pathname, we need to provide an extra slash as given below:

curl “ftp://root:blahroot@192.168.8.192//var/tmp/x.html”

We can also try fiddling with curl’s option –ftp-method

–ftp-method [method]

The method argument should be one of the following alternatives:

  • multicwd

A default but slowest behavior, multicwd curl does a single CWD operation for each path part in the given URL.

  • nocwd

The fastest behavior, nocwd curl does no CWD at all. CURL will do SIZE, RETR, STOR, etc, and give a full path to the server for all these commands.

  • singlecwd

singlecwd curl does one CWD with the full target directory and then operates on the file “normally”. It is somewhat more preferable than ‘nocwd’ but without the full penalty of ‘multicwd’.

 

Solution

In order to solve the error, we need to check the default landing directory in the vsftpd.conf file and mention the repo path in the /etc/yum.repos.d/<repo File Name> minus the landing directory.

vsftp default directory is /var/ftp and repos directory is /var/ftp/pub/yum/rhel6
[root@test ~]# cat /etc/yum.repos.d/local.repo
[rhel6]
name=rhel6
baseurl=ftp://ip of the server/pub/yum/rhel6
gpgcheck=0
enabled=1
[root@test ~]#
[root@test ~]# yum repolist
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rhel6 | 3.6 kB 00:00
repo id repo name status
rhel6 rhel6 3,785
repolist: 3,785

[Stuck with the error? We’d be happy to assist you]

 

Conclusion

To conclude, this error occurs when we are denied access to the resource given in the URL. today, we saw an effective way our Support Engineers employ in order to fix it.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF