Vsftpd ошибка 500

Skip to content

After upgrading vsftpd or vsftpd-ext you may be getting the following message when trying to log in.

500 OOPS: vsftpd: refusing to run with writable root inside chroot ()

This is due to the following update:

– Add stronger checks for the configuration error of running with a writeable
root directory inside a chroot(). This may bite people who carelessly turned
on chroot_local_user but such is life.

The problem is that your users root directory is writable, which isn’t allowed when using chroot restrictions in the new update.

To fix this you must either remove write permissions on the users root directory with the following command, replacing the directory with your users root:

chmod a-w /home/user

Or you can work around this security check by adding either of the two below into your configuration file.

For the standard vsFTPd build (vsftpd):

allow_writeable_chroot=YES

For the extended vsFTPd build (vsftpd-ext):

allow_writable_chroot=YES

Removing the write permission on the root isn’t a perfect solution as doing this can cause a few problems with things that need to write to the root directory, such as the bash history file or some graphical environments.

Dmitriy has suggested 3 ways to also overcome this problem, be sure to check them out.

В целях безопасности корневая директория FTP сервера должна быть защищена от записи. И если Вы только что установили VSFTPD и пытаетесь подключиться, можете получить такую ошибку.

Command: USER xxx
Response: 331 Please specify the password.
Command: PASS ******************
Response: 500 OOPS: vsftpd: refusing to run with writable root inside chroot()
Error: Critical error: Could not connect to server

И это нормально в том случае, когда для пользователя, от которого Вы подключаетесь по FTP, корневая директория доступна для записи. Все, что Вам необходимо сделать, это установить права Read-only для этого пользователя. Но если все же нужны права именно записи в этой корневой директории (например, когда Вы используете FTP только для себя), то достаточно внести в конфигурацию VSFTPD сервера (/etc/vsftpd/vsftpd.conf) следующую строку:

allow_writeable_chroot=YES

После этого просто перезапустите службу VSFTPD

# service vsftpd restart

Теперь пробуйте подключиться к FTP снова. На этот раз все должно быть ок!


I want to setup an anonymous only FTP server (able to upload files). Here is my configuration file:

listen=YES

anonymous_enable=YES
anon_root=/var/www/ftp

local_enable=YES
write_enable=YESr.

anon_upload_enable=YES
anon_mkdir_write_enable=YES

xferlog_enable=YES
connect_from_port_20=YES

chroot_local_user=YES

dirmessage_enable=YES
use_localtime=YES
secure_chroot_dir=/var/run/vsftpd/empty
rsa_cert_file=/etc/ssl/private/vsftpd.pem
pam_service_name=vsftpd

But when I try to connect it:

kan@kan:~$ ftp yxxxng.bej
Connected to yxxx.
220 (vsFTPd 2.3.5)
Name (yxxxg.bej:kan): anonymous
331 Please specify the password.
Password:
500 OOPS: vsftpd: refusing to run with writable root inside chroot()
Login failed

How can I fix this?

I am fully aware this question was asked countless times, but no solution mentioned before worked for my case.

My config:

$ cat /etc/vsftpd-anon.conf 
listen=YES
local_enable=NO
anonymous_enable=YES
write_enable=YES
anon_root=/var/anonftp
xferlog_enable=YES
listen_address=10.0.0.2
listen_port=9988
allow_writeable_chroot=YES

See, I am not using any home directory things. There is this one directory I created especially for this case. I also added allow_writeable_chroot option and vsftpd recognizes it, but IGNORES IT.

target directory:

$ ls -l /var/ | grep anonftp
drwxrwxrwx  3 root root      4096 led 26 11:09 anonftp

How I try to use it:

$ sudo killall vsftpd 
$ sudo vsftpd /etc/vsftpd-anon.conf &
[1] 21064
$ ftp 10.0.0.2 9988
Connected to 10.0.0.2.
220 (vsFTPd 3.0.2)
Name (10.0.0.2:david): anonymous
331 Please specify the password.
Password:
500 OOPS: vsftpd: refusing to run with writable root inside chroot()
Login failed.

Nothing in vsftpd.log

asked Jan 26, 2016 at 10:35

David162795's user avatar

3

Run echo "allow_writeable_chroot=YES" >> /etc/vsftpd.conf && service vsftpd restart

You'reAGitForNotUsingGit's user avatar

answered Apr 5, 2016 at 15:58

Gilles's user avatar

I had the same problem and nothing helped.
not:

  1. allow_writeable_chroot=YES at vsftpd.conf
  2. chmod to the ftp root directory

    so I made a strace to the vsftpd process and saw the following lines:

...
18825 chdir("/usr/share/empty")         = 0
18825 chroot(".")                       = 0
...

after changing the permissions on /usr/share/empty with

chmod 0644 /usr/share/empty

the error was gone.

answered Nov 29, 2017 at 14:07

0x0C4's user avatar

0x0C40x0C4

6835 silver badges12 bronze badges

3

echo "allow_writeable_chroot=YES" >> /etc/vsftpd.conf && service vsftpd restart

Run the above command every time when editing conf.

storm's user avatar

storm

4,9236 gold badges34 silver badges48 bronze badges

answered Jul 21, 2016 at 11:45

Sheikh Wasim's user avatar

1

SHORT

In my case, with pretty same configuration, problem was that the newly created user didn’t had it’s own /home/{username} directory

LONG

In vsftpd.conf, I had that lines:

...
user_sub_token=$USER
local_root=/var/www/$USER
...

Not sure, but, it looks like vsftpd tries to log user into user’s /home directory first, then on success it does chroot() to local_root, and because user didn’t had it’s own /home/{username} directory — it failed with error above.

So, by adding /home/{username} directory and setting user as owner — solved it!

answered Jan 12, 2020 at 3:20

lambidu's user avatar

Are you looking for a solution to the error ‘500 oops vsftpd refusing to run with writable root inside chroot()’? We can help you in fixing it.

Here at Bobcares, we have seen several such vsftpd related errors as a part of our Server Management Services for web hosts and online service providers.

Today, we’ll take a look at the cause of this error to occur and also see how to fix it.

Why does ‘500 oops vsftpd refusing to run with writable root inside chroot()’ error occur

This error mainly occurs when you have newly installed the vsftpd on a Linux server and trying to FTP to it.

Also, after upgrading the vsftpd or vsftpd-ext, you may come across this error message while connecting to FTP.

For instance, the error appears as shown in the below image.

500 oops vsftpd refusing to run with writable root inside chroot()

Remedy for this vsftpd refusing error

Now let us see how our Support Engineers resolve this error message to our customers.

The best fix is to create a separate Linux user specifically for FTP only that can’t log in via SSH.

In case, if you wish to remove the SSH access for a test user then you can run the below command.

$ usermod -s /sbin/nologin testuser

However, this will not completely fix the error. So we need to modify the user’s home directory to read-only. Here, we are assuming the username to be testuser and the home directory to be /home/testuser. Then we run the below command.

$ chmod a-w /home/testuser

Finally, restart the vsftpd by running the below command.

$ systemctl restart vsftpd

Alternatively, you can try bypassing the writable check in the vsftpd config file by executing the below command.

$ echo ‘allow_writeable_chroot=YES’ >> /etc/vsftpd/vsftpd.conf && systemctl restart vsftpd

[Need any further assistance in fixing vsftpd errors? – We are here to help you.]

Conclusion

In short, this error occurs while connecting to vsftpd if it is a newly installed vsftpd or if it is upgraded. Today, we saw how our Support Engineers resolve this error message.

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»;

I configured an FTP server for Ubuntu using vsftpd. However, I can’t access the server.

Status: Connecting to IP
Status: Connection established, waiting for welcome message...
Response:   220 (vsFTPd 2.3.2)
Command:    USER userhere
Response:   331 Please specify the password.
Command:    PASS ***************
Response:   500 OOPS: could not read chroot() list file:/etc/vsftpd.chroot_list
Error:  Critical error
Error:  Could not connect to server

EDIT

The problem was solved ! Comment the line chroot_list_enable=YES

Castaglia's user avatar

Castaglia

3,3493 gold badges21 silver badges42 bronze badges

asked Jan 29, 2012 at 1:33

gustavosiq's user avatar

1

Quick fix would be to disable chroot_list_enable switch in your conf file for Vsftpd( usually in /etc/vsftpd.conf)

#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd.chroot_list

Comment out mentioned line above and see it helps or not.

answered Jan 29, 2012 at 2:45

kaji's user avatar

kajikaji

2,51816 silver badges17 bronze badges

you must apply below command,

setsebool -P ftp_home_dir on

setsebool -P allow_ftpd_full_access=1

I solved this method.

James A Mohler's user avatar

answered Dec 4, 2012 at 20:26

Bilgehan POYRAZ's user avatar

Кое-как разобрался с настройкой VSFTPD по мануалам. Нашел в них маленькую ошибку, нашел в своих потугах маленькую ошибку. Передаю флаг дальше.

Настройка vsftpd.conf

Не считая проблем с преобразованием некоторых символов в тексте и кривого перевода, мануал от ISS подходит для конфигурации vsftpsd.conf, создания отдельного пользователя и создания безопасного пути для соединения с сервером.

На случай, если искаженные команды непонятны или интересен другой взгляд на решение проблемы, вот хороший вариант от Digital Ocean на английском языке.

Остановитесь на этапе «настройка SSL», не выполняя его. Обращаю ваше внимание на то, что хоть инструкции и относительно похожи, они не идентичны.

Об используемых параметрах можно узнать из мануала или с помощью его локализации от aitishnik.ru.

Корректировки

Обратите внимание на параметры:

listen=X
listen_ipv6=X

Здесь вам решать через какой IP протокол вы будете выполнять соединение. Эти параметры самостоятельны и не влияют на остальные в конфигурационном файле.

Далее обратите внимание на параметр:

secure_chroot_dir=/var/run/vsftpd/empty

«This directory was once intended for system information data describing the system since it was booted»

/var/run/ — это временная файловая система. Если вы создадите в ней каталог, после перезапуска системы каталога там может не быть.

Обойти это можно создав каталог в самой /var/, например /var/vsftpd/. Имейте в виду, что «каталог не должен быть записываемый для ftp пользователя«.

FTP — 500 OOPS: priv_sock_get_cmd

Теперь можно совершить первое подключение к своему серверу через VSFTPD. Настоятельно рекомендую для этого использовать FTP клиент, например FileZilla. Это значительно упростит вам жизнь сейчас и после добавления SSL сертификатов.

После первой попытки подключиться, вас встретит (или уже встретила) ошибка из заголовка. Если этап настроек VSFTPD, создания пользователей и каталогов пройден без ошибок, решить проблему можно добавив (или раскомментировав) параметр:

seccomp_sandbox=NO

Этого параметра лично я в мануалах VSFTPD не вижу, но пояснения можно найти на сайте SUSE.

seccomp_sandbox add an aditional security layer limiting the number of a syscalls can be performed via vsftpd. However it might happen that a whitelist don’t allow a legitimate call (usually indirectly triggered by third-party library like pam, or openssl) and the process is being killed by kernel.

suse.com

Теперь вас должно пустить на сервер.

Коротко — добавление SSL сертификатов и ещё одна проблема, связанная с конфигом

Касательно добавления самописных сертификатов. Рекомендую статью в блоге That’s geeky. В неё входят и самописные сертификаты, и сертификаты от третьих лиц. Обратите внимание на приведенные пути к каталогам и сверьтесь со своими.

На свое усмотрение можно использовать методы, представленные ISS или Digital Ocean, где DO подробнее углубляются в данную тему.

Методы получения сертификатов и дальнейшей правки конфигурационного файлов у всех отличаются, но все они тем или иным методом затрагивают параметры:

#На примере Digital Ocean
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO

Если указать в конфигурационном файле параметр «ssl_sslv3», то перезагрузка сервиса VSFTPD закончится неудачей. Без этого параметра сервис, настроенный по примеру That’s geeky, запускается и работает штатно.

Если верить приведенным в начале публикации мануалам, sslv2 и sslv3 выключены по умолчанию, тем временем как tlsv1 включен.

ssl_sslv3

Only applies if ssl_enable is activated. If enabled, this option will permit SSL v3 protocol connections. TLS v1 connections are preferred.

Default: NO

man

В зависимости от выбранного вами метода настройки, отсутствие в конфиге sslv3 навредить не должно. Но мое умозаключение ничего не стоит ибо основано оно на предположении и коротком наблюдении.

На данном этапе два моих дня мук с конфигом VSFTPD подходят к концу.

Благодарю за внимание и приветствую поправки написанного в комментариях.

Понравилась статья? Поделить с друзьями:
  • Vsc ошибка тойота сиена
  • Vsc ошибка на лексусе rx350
  • Vsc ошибка лексус is 250
  • Vsc trc ошибка toyota rav4
  • Vsc toyota ошибка тойота