Пытаясь разобраться с настройками vsftpd, я (опять) "забыл" про SELinux. Зато нашел две отличных ссылки (клик по картинке- два фрейма) Сначала создается папка где нибудь (в домашнем каталоге), потом в нее помещается ссылка на var/www/html а потом надо еще разобраться с SELinux "Этот пост - эксперимент. Я... вроде бы, осваиваю Linux, но делать это проиходится на конкретных примерах. Если бы я получил систематическое (хорошее) образование , то все было бы легче... Но меня учили мат. методам решения нелинейных уравнений в частных производных..., а сисадминов мы считали черной костью, далекими от творческих озарений занудами...
Сисадмины теперь востребованы, а решатели "стохастических интегральных уравнений" да еще и ..."методом регуляризации" нафиг никому не нужны...
Зато я хорошо понимаю, что теоретические пробелы - это плохо... И я умею их ликвидировать... Пробелы бывают двух видов:
1. Не знаешь сам предмет (Linux) ... причем, есть теория (1.1) и есть практика (1.2), без которой теорию просто не запомнишь...
2. Не знаешь "смежные" предметы это более общие "теоретические основы" (2.1), например "Операционные системы" (книга Дейтела), и собственно "смежные" предметы, например принципы настройки ядра..., прерывания... или программирования драйверов, без знания которых можно обойтись..., но рано или поздно обязательно спотнекшься об это незнание...
Собственно, сам предмет "Linux" - это "смежный предмет", поскольку моя главная задача - это интернет- проект на LAMP... Но без моих теперешних знаний LAMP, у меня не было бы уверенности в успехе проекта моей новой социальной сети.
Так что получается, что я нахожусь в неком переходном положении, когда надо начинать управлять проектом (ресурсы, задачи, сроки) запуска пилотного сайта. Но я решил все это сделать сам, а мне мешают пробелы вида (1.2) - нехватка практического опыта.
Пока не знаю, как быть... Если переключится на работу с проектом, то SELinux нужно просто "выключить", а если дать себе время на освоение Linux, то возникает когнитивный диссонанс... Прочитал более 100 страниц про SElenux, понял, что в ближайший год-два это тебе точно не пригодится..., а вот "пилот" точно подвиснет при таком подходе, причем надолго...
В послепраздничном полусне я довольно долго возился с настройками. Все дело было в том, что голова отказывалась "думать". Наверное, мозгу надоело учиться. За послдений месяц перечитал несколько книг по Linux, а до этого Windows.
Потому, сначала о методологии. Я плохо понимаю "юниксоидов", а потому пытался найти доументацию по Centos, потом запись в каком-нибудь блоге..., а находились только форумы. Так что, мой организм ленился, чтобы уберечь себя от лишней работы...
Надо было искать документацию redhat..., тем более, что я, помнится, даже когда-то скачал себе pdf руководство (куда - не помню...). В конце концов я нашел целых два руководства, скачал их себе в textbook и прочитал (в метро..., потом лежа на диване)
Под root-ом, наберите в консоли:
# yum install vsftpd
Этот пакет входит в стандартный репозитарий CentOS, поэтому проблем с установкой возикнуть не должно.
Добавим запуск сервера при старте системы:
# chkconfig vsftpd on
Для интереса проверим теперь уровни запуска:
# chkconfig --list vsftpd
получаем:
vsftpd 0:выкл 1:выкл 2:вкл 3:вкл 4:вкл 5:вкл 6:выкл
На этом можно считать законченным процесс установки. При перезагрузке системы - сервер будет активирован. Если вы его хотите запустить сейчас, то набирите:
# service vsftpd start
Внимание. В настройках файрвола вы должны разрешить подключения к своему серверу. Например через текстовую утилиту настройки:
# system-config-securitylevel Сначала я не мог понять, как создавать ftp-пользователей, оказалось, что это пользователи Linux.
Потом, не мог подключиться к серверу, т.е., сервер запускался # service vsftpd start
агент ftp отвечал на все комманды: disconnected,
оказывается надо было набирать ftp localhost, но перед этим запустить сервис, как демон # chkconfig vsftpd on (а я не хотел этого делать...)
Но, после того, как я успешно подключился к своим папкам Altersego, оказалось, что доступ к home директории получить не так просто, не говоря уже о var/www/html...
Теперь, я начал писать эти строки еще не прочитав инструкции... во фреймах
В первых (15-ти) комментариях скопировано руководство по работе с ftp клиентом. А вот сервер на моем ноутбуке - vsftpt (very secure...), говорят, что все настройки собраны в одном файле /etc/vsftpd/vsftpd.conf. Но в папке /etc/vsftpd есть еще файлы...
В конечном итоге, оказалось, что я опять не учел "умолчания". Итак "сборка" Centos - это, скорее всего, копия сборки RedHat, в которой все умолчания во всех конфигурационных файлах уже настроены так, как надо...!!! Надо просто тупо прочитать документацию в usr/share/doc/...а можно и не напрягаться...
Но разобраться с правами доступа надо было, ведь владельцем файлов становится процесс (пользователь) ftp, которого надо было вручную создать и назначить... (см. видео), а можно было попробовать подключиттся к ftp, как текущий пользователь (см. в комментариях).
Действительно трудной показалась проблема с типом в SELinux, даже домашняя папка пользователя Altersego была видна через ftp, но файлы в ней не открывались...
Пришлось потратить уйму времени на то, чтобы разобраться, как настраивать SELinux (клик по картинке откроет два фрейма с документами RedHat).
Самым простым решением оказалось временное отключение сервиса # setenforce 0 (перевод в режим permissive). После этого я наконец смог увидеть все папки и файлы через ftp и gFtp.
Кроме того, можно было бы использовать присвоение типа unconfined_ процессу как в примере (см. документацию по SELinux стр. 20 Chapter 4. Targeted Policy)... или воспоьзоваться рекомендациями по настройке vsftpd из второго документа (во фрейме).
Ниже видео с рекомендациями по настройке vsftpd
FTP(1)
ОтветитьУдалитьNAME
ftp - ARPANET file transfer program
SYNOPSIS
ftp [-v] [-d] [-i] [-n] [-g] [-k realm] [-f] [-x] [-u] [-t] [host]
DESCRIPTION
FTP is the user interface to the ARPANET standard File Transfer Proto-
col. The program allows a user to transfer files to and from a remote
network site.
OPTIONS
Options may be specified at the command line, or to the command inter-
preter.
-v Verbose option forces ftp to show all responses from the remote
server, as well as report on data transfer statistics.
-n Restrains ftp from attempting ‘‘auto-login’’ upon initial con-
nection. If auto-login is enabled, ftp will check the .netrc
(see below) file in the user’s home directory for an entry
describing an account on the remote machine. If no entry
exists, ftp will prompt for the remote machine login name
(default is the user identity on the local machine), and, if
necessary, prompt for a password and an account with which to
login.
-u Restrains ftp from attempting ‘‘auto-authentication’’ upon ini-
tial connection. If auto-authentication is enabled, ftp
attempts to authenticate to the FTP server by sending the AUTH
command, using whichever authentication types are locally sup-
ported. Once an authentication type is accepted, an authentica-
tion protocol will proceed by issuing ADAT commands. This
-i Turns off interactive prompting during multiple file transfers.
Удалить-d Enables debugging.
-g Disables file name globbing.
-k realm
When using Kerberos v4 authentication, gets tickets in realm.
-f Causes credentials to be forwarded to the remote host.
-x Causes the client to attempt to negotiate encryption (data and
command protection levels ‘‘private’’) immediately after suc-
cessfully authenticating.
-t Enables packet tracing.
COMMANDS
The client host with which ftp is to communicate may be specified on
the command line. If this is done, ftp will immediately attempt to
establish a connection to an FTP server on that host; otherwise, ftp
will enter its command interpreter and await instructions from the
user. When ftp is awaiting commands from the user the prompt ‘‘ftp>’’
is provided to the user. The following commands are recognized by ftp:
! [command] [args]]
Invoke an interactive shell on the local machine. If there are
arguments, the first is taken to be a command to execute
directly, with the rest of the arguments as its arguments.
$ macro-name [args]
Execute the macro macro-name that was defined with the macdef
command. Arguments are passed to the macro unglobbed.
account [passwd]
Supply a supplemental password required by a remote system for
access to resources once a login has been successfully com-
pleted. If no argument is included, the user will be prompted
for an account password in a non-echoing input mode.
append local-file [remote-file]
УдалитьAppend a local file to a file on the remote machine. If remote-
file is left unspecified, the local file name is used in naming
the remote file after being altered by any ntrans or nmap set-
ting. File transfer uses the current settings for type, format,
mode, and structure.
ascii Set the file transfer type to network ASCII . This is the
default type.
bell Arrange that a bell be sounded after each file transfer command
is completed.
binary Set the file transfer type to support binary file transfer.
bye Terminate the FTP session with the remote server and exit ftp.
An end of file will also terminate the session and exit.
case Toggle remote computer file name case mapping during mget com-
mands. When case is on (default is off), remote computer file
names with all letters in upper case are written in the local
directory with the letters mapped to lower case.
ccc Turn off integrity protection on the command channel. This com-
mand must be sent integrity protected, and must be proceeded by
a successful ADAT command. Since turning off integrity protec-
tion potentially allows an attacker to insert commands onto the
command channel, some FTP servers may refuse to honor this com-
mand.
cd remote-directory
Change the working directory on the remote machine to remote-
directory.
cdup Change the remote machine working directory to the parent of the
current remote machine working directory.
chmod mode file-name
Change the permission modes of the file file-name on the remote
clear Set the protection level on data transfers to ‘‘clear’’. If no
УдалитьADAT command succeeded, then this is the default protection
level.
close Terminate the FTP session with the remote server, and return to
the command interpreter. Any defined macros are erased.
cprotect [protection-level]
Set the protection level on commands to protection-level. The
valid protection levels are ‘‘clear’’ for unprotected commands,
‘‘safe’’ for commands integrity protected by cryptographic
checksum, and ‘‘private’’ for commands confidentiality and
integrity protected by encryption. If an ADAT command suc-
ceeded, then the default command protection level is ‘‘safe’’,
otherwise the only possible level is ‘‘clear’’. If no level is
specified, the current level is printed. cprotect clear is
equivalent to the ccc command.
cr Toggle carriage return stripping during ascii type file
retrieval. Records are denoted by a carriage return/linefeed
sequence during ascii type file transfer. When cr is on (the
default), carriage returns are stripped from this sequence to
conform with the UNIX single linefeed record delimiter. Records
on non-UNIX remote systems may contain single linefeeds; when an
ascii type transfer is made, these linefeeds may be distin-
guished from a record delimiter only when cr is off.
delete remote-file
Delete the file remote-file on the remote machine.
debug [debug-value]
Toggle debugging mode. If an optional debug-value is specified
it is used to set the debugging level. When debugging is on,
ftp prints each command sent to the remote machine, preceded by
the string ‘-->’
dir [remote-directory] [local-file]
УдалитьPrint a listing of the directory contents in the directory,
remote-directory, and, optionally, placing the output in local-
file. If interactive prompting is on, ftp will prompt the user
to verify that the last argument is indeed the target local file
for receiving dir output. If no directory is specified, the
current working directory on the remote machine is used. If no
local file is specified, or local-file is ‘-’, output comes to
the terminal.
disconnect
A synonym for close.
form format
Set the file transfer form to format. The default format is
‘‘file’’.
get remote-file [local-file]
Retrieve the file remote-file and store it on the local machine.
If the local file name is not specified, it is given the same
name it has on the remote machine, subject to alteration by the
current case, ntrans, and nmap settings. The current settings
for type, form, mode, and structure are used while transferring
the file.
glob Toggle filename expansion for mdelete, mget, and mput. If glob-
bing is turned off with glob, the file name arguments are taken
literally and not expanded. Globbing for mput is done as in
csh(1). For mdelete and mget, each remote file name is expanded
separately on the remote machine and the lists are not merged.
Expansion of a directory name is likely to be different from
expansion of the name of an ordinary file: the exact result
depends on the foreign operating system and ftp server, and can
be previewed by doing ‘mls remote-files -’ Note: mget and mput
are not meant to transfer entire directory subtrees of files.
That can be done by transferring a tar(1) archive of the subtree
(in binary mode).
hash Toggle hash-sign (‘‘#’’) printing for each data block trans-
Удалитьferred. The size of a data block is 1024 bytes.
help [command]
Print an informative message about the meaning of command. If
no argument is given, ftp prints a list of the known commands.
idle [seconds]
Set the inactivity timer on the remote server to seconds sec-
onds. If seconds is omitted, the current inactivity timer is
printed.
lcd [directory]
Change the working directory on the local machine. If no direc-
tory is specified, the user’s home directory is used.
ls [remote-directory] [local-file]
Print a listing of the contents of a directory on the remote
machine. The listing includes any system-dependent information
that the server chooses to include; for example, most UNIX sys-
tems will produce output from the command ‘ls -l’. (See also
nlist.) If remote-directory is left unspecified, the current
working directory is used. If interactive prompting is on, ftp
will prompt the user to verify that the last argument is indeed
the target local file for receiving ls output. If no local file
is specified, or if local-file is ‘-’, the output is sent to the
terminal.
macdefmacro-name
УдалитьDefine a macro. Subsequent lines are stored as the macro macro-
name; a null line (consecutive newline characters in a file or
carriage returns from the terminal) terminates macro input mode.
There is a limit of 16 macros and 4096 total characters in all
defined macros. Macros remain defined until a close command is
executed. The macro processor interprets ‘$’ and ‘\’ as special
characters. A ‘$’ followed by a number (or numbers) is replaced
by the corresponding argument on the macro invocation command
line. A ‘$’ followed by an ‘i’ signals that macro processor
that the executing macro is to be looped. On the first pass
‘$i’ is replaced by the first argument on the macro invocation
command line, on the second pass it is replaced by the second
argument, and so on. A ‘\’ followed by any character is
replaced by that character. Use the ‘\’ to prevent special
treatment of the ‘$’.
mdelete [remote-files]
Delete remote-files on the remote machine.
mdir remote-files local-file
Like dir, except multiple remote files may be specified. If
interactive prompting is on, ftp will prompt the user to verify
that the last argument is indeed the target local file for
receiving mdir output.
mget remote-files
Expand the remote-files on the remote machine and do a get for
each file name thus produced. See glob for details on the file-
name expansion. Resulting file names will then be processed
according to case, ntrans, and nmap settings. Files are trans-
ferred into the local working directory, which can be changed
with ‘lcd directory’; new local directories can be created with
‘! mkdir directory’.
mkdir directory-name
Make a directory on the remote machine.
mls remote-files local-file
Like nlist, except multiple remote files may be specified, and
the local-file must be specified. If interactive prompting is
on, ftp will prompt the user to verify that the last argument is
indeed the target local file for receiving mls output.
mode [mode-name]
УдалитьSet the file transfer mode to mode-name. The default mode is
‘‘stream’’ mode.
modtime file-name
Show the last modification time of the file on the remote
machine.
mput local-files
Expand wild cards in the list of local files given as arguments
and do a put for each file in the resulting list. See glob for
details of filename expansion. Resulting file names will then
be processed according to ntrans and nmap settings.
newer file-name
Get the file only if the modification time of the remote file is
more recent that the file on the current system. If the file
does not exist on the current system, the remote file is consid-
ered newer. Otherwise, this command is identical to get.
nlist [remote-directory] [local-file]
Print a list of the files in a directory on the remote machine.
If remote-directory is left unspecified, the current working
directory is used. If interactive prompting is on, ftp will
prompt the user to verify that the last argument is indeed the
target local file for receiving nlist output. If no local file
is specified, or if local-file is ‘-’, the output is sent to the
terminal.
nmap [inpattern outpattern]
УдалитьSet or unset the filename mapping mechanism. If no arguments
are specified, the filename mapping mechanism is unset. If
arguments are specified, remote filenames are mapped during mput
commands and put commands issued without a specified remote tar-
get filename. If arguments are specified, local filenames are
mapped during mget commands and get commands issued without a
specified local target filename. This command is useful when
connecting to non-UNIX remote computer with different file nam-
ing conventions or practices. The mapping follows the pattern
set by inpattern and outpattern. [Inpattern] is a template for
incoming filenames (which may have already been processed
according to the ntrans and case settings). Variable templating
is accomplished by including the sequences ‘$1’, ‘$2’, ..., ‘$9’
in inpattern. Use ‘\’ to prevent this special treatment of the
‘$’ character. All other characters are treated literally, and
are used to determine the nmap [inpattern] variable values. For
example, given inpattern $1.$2 and the remote file name
"mydata.data", $1 would have the value "mydata", and $2 would
have the value "data". The outpattern determines the resulting
mapped filename. The sequences ‘$1’, ‘$2’, inpattern template.
The sequence ‘$0’ is replace by the original filename. Addi-
tionally, the sequence ‘[seq1, seq2]’ is replaced by [seq1] if
seq1 is not a null string; otherwise it is replaced by seq2.
For example, the command
nmap $1.$2.$3 [$1,$2].[$2,file]
would yield the output filename "myfile.data" for input file-
names "myfile.data" and "myfile.data.old", "myfile.file" for the
input filename "myfile", and "myfile.myfile" for the input file-
name ".myfile". Spaces may be included in outpattern, as in the
example: ‘nmap $1 sed "s/ *$//" > $1’. Use the ‘\’ character to
prevent special treatment of the ‘$’,’[’,’]’, and ‘,’ charac-
ters.
ntrans [inchars [outchars]]
УдалитьSet or unset the filename character translation mechanism. If
no arguments are specified, the filename character translation
mechanism is unset. If arguments are specified, characters in
remote filenames are translated during mput commands and put
commands issued without a specified remote target filename. If
arguments are specified, characters in local filenames are
translated during mget commands and get commands issued without
a specified local target filename. This command is useful when
connecting to a non-UNIX remote computer with different file
naming conventions or practices. Characters in a filename
matching a character in inchars are replaced with the corre-
sponding character in outchars. If the character’s position in
inchars is longer than the length of outchars, the character is
deleted from the file name.
open host [port] [-forward]
Establish a connection to the specified host FTP server. An
optional port number may be supplied, in which case, ftp will
attempt to contact an FTP server at that port. If the auto-
authenticate option is on (default), ftp will attempt to authen-
ticate to the FTP server by sending the AUTH command, using
whichever authentication types which are locally supported.
Once an authentication type is accepted, an authentication pro-
tocol will proceed by issuing ADAT commands. If the auto-login
option is on (default), ftp will also attempt to automatically
log the user in to the FTP server (see below). If the -forward
option is specified, ftp will forward a copy of the user’s Ker-
beros tickets to the remote host.
passive
Toggle passive data transfer mode off. In passive mode, the
client initiates the data connection by connecting to the data
port. Passive mode is often necessary for operation from behind
firewalls which do not permit incoming connections, but may need
to be disabled if you connect to an FTP server which does not
support passive operation.
private
Set the protection level on data transfers to ‘‘private’’. Data
transmissions are confidentiality and integrity protected by
encryption. If no ADAT command succeeded, then the only possi-
ble level is ‘‘clear’’.
prompt Toggle interactive prompting. Interactive prompting occurs dur-
Удалитьing multiple file transfers to allow the user to selectively
retrieve or store files. If prompting is turned off (default is
on), any mget or mput will transfer all files, and any mdelete
will delete all files.
protect [protection-level]
Set the protection level on data transfers to protection-level.
The valid protection levels are ‘‘clear’’ for unprotected data
transmissions, ‘‘safe’’ for data transmissions integrity pro-
tected by cryptographic checksum, and ‘‘private’’ for data
transmissions confidentiality and integrity protected by encryp-
tion. If no ADAT command succeeded, then the only possible
level is ‘‘clear’’. If no level is specified, the current level
is printed. The default protection level is ‘‘clear’’.
proxy ftp-command
Execute an ftp command on a secondary control connection. This
command allows simultaneous connection to two remote ftp servers
for transferring files between the two servers. The first proxy
command should be an open , to establish the secondary control
connection. Enter the command "proxy ?" to see other ftp com-
mands executable on the secondary connection. The following
commands behave differently when prefaced by proxy: open will
not define new macros during the auto-login process, close will
not erase existing macro definitions, get and mget transfer
files from the host on the primary control connection to the
host on the secondary control connection, and put, mput, and
append transfer files from the host on the secondary control
connection to the host on the primary control connection. Third
party file transfers depend upon support of the ftp protocol
PASV command by the server on the secondary control connection.
put local-file [remote-file]
Store a local file on the remote machine. If remote-file is
left unspecified, the local file name is used after processing
according to any ntrans or nmap settings in naming the remote
file. File transfer uses the current settings for type, format,
mode, and structure.
pwd Print the name of the current working directory on the remote
machine.
quit A synonym for bye.
Удалитьquote arg1 [arg2] [...]
The arguments specified are sent, verbatim, to the remote FTP
server.
recv remote-file [local-file]
A synonym for get.
reget remote-file [local-file]
Reget acts like get, except that if local-file exists and is
smaller than remote-file, local-file is presumed to be a par-
tially transferred copy of remote-file and the transfer is con-
tinued from the apparent point of failure. This command is use-
ful when transferring very large files over networks that are
prone to dropping connections.
remotehelp [command-name]
Request help from the remote FTP server. If a command-name is
specified it is supplied to the server as well.
remotestatus [file-name]
With no arguments, show status of remote machine. If file-name
is specified, show status of file-name on remote machine.
rename [from] [to]
Rename the file from on the remote machine, to the file to.
reset Clear reply queue. This command re-synchronizes command/reply
sequencing with the remote ftp server. Resynchronization may be
necessary following a violation of the ftp protocol by the
remote server.
restart marker
Restart the immediately following get or put at the indicated
marker. On UNIX systems, marker is usually a byte offset into
the file.
rmdir directory-name
Delete a directory on the remote machine.
runique
Toggle storing of files on the local system with unique file-
runique
УдалитьToggle storing of files on the local system with unique file-
names. If a file already exists with a name equal to the target
local filename for a get or mget command, a ".1" is appended to
the name. If the resulting name matches another existing file,
a ".2" is appended to the original name. If this process con-
tinues up to ".99", an error message is printed, and the trans-
fer does not take place. The generated unique filename will be
reported. Note that runique will not affect local files gener-
ated from a shell command (see below). The default value is
off.
safe Set the protection level on data transfers to ‘‘safe’’. Data
transmissions are integrity-protected by cryptographic checksum.
If no ADAT command succeeded, then the only possible level is
‘‘clear’’.
send local-file [remote-file]
A synonym for put.
sendport
Toggle the use of PORT commands. By default, ftp will attempt
to use a PORT command when establishing a connection for each
data transfer. The use of PORT commands can prevent delays when
performing multiple file transfers. If the PORT command fails,
ftp will use the default data port. When the use of PORT com-
mands is disabled, no attempt will be made to use PORT commands
for each data transfer. This is useful for certain FTP imple-
mentations which do ignore PORT commands but, incorrectly, indi-
cate they’ve been accepted.
site arg1 [arg2] [...]
The arguments specified are sent, verbatim, to the remote FTP
server as a SITE command.
size file-name
Return size of file-name on remote machine.
status Show the current status of ftp.
struct struct-name
Set the file transfer structure to struct-name. By default
‘‘stream’’ structure is used.
sunique
УдалитьToggle storing of files on remote machine under unique file
names. Remote ftp server must support ftp protocol STOU command
for successful completion. The remote server will report unique
name. Default value is off.
system Show the type of operating system running on the remote machine.
tenex Set the file transfer type to that needed to talk to TENEX
machines.
trace Toggle packet tracing.
type [type-name]
Set the file transfer type to type-name. If no type is speci-
fied, the current type is printed. The default type is network
ASCII.
umask [newmask]
Set the default umask on the remote server to newmask. If new-
mask is omitted, the current umask is printed.
user user-name [password] [account]
Identify yourself to the remote FTP server. If the password is
not specified and the server requires it, ftp will prompt the
user for it (after disabling local echo). If an account field
is not specified, and the FTP server requires it, the user will
be prompted for it. If an account field is specified, an
account command will be relayed to the remote server after the
login sequence is completed if the remote server did not require
it for logging in. Unless ftp is invoked with ‘‘auto-login’’
disabled, this process is done automatically on initial connec-
tion to the FTP server.
verbose
Toggle verbose mode. In verbose mode, all responses from the
FTP server are displayed to the user. In addition, if verbose
is on, when a file transfer completes, statistics regarding the
efficiency of the transfer are reported. By default, verbose is
on.
? [command]
A synonym for help.
Command arguments which have embedded spaces may be quoted with quote
Удалить‘"’ marks.
ABORTING A FILE TRANSFER
To abort a file transfer, use the terminal interrupt key (usually Ctrl-
C). Sending transfers will be immediately halted. Receiving transfers
will be halted by sending a FTP protocol ABOR command to the remote
server, and discarding any further data received. The speed at which
this is accomplished depends upon the remote server’s support for ABOR
processing. If the remote server does not support the ABOR command, an
‘ftp>’ prompt will not appear until the remote server has completed
sending the requested file.
The terminal interrupt key sequence will be ignored when ftp has com-
pleted any local processing and is awaiting a reply from the remote
server. A long delay in this mode may result from the ABOR processing
described above, or from unexpected behavior by the remote server,
including violations of the ftp protocol. If the delay results from
unexpected remote server behavior, the local ftp program must be killed
by hand.
FILE NAMING CONVENTIONS
Files specified as arguments to ftp commands are processed according to
the following rules.
1. If the file name ‘-’ is specified, stdin (for reading) or stdout
(for writing) is used.
2. If the first character of the file name is ‘|’, the remainder of
the argument is interpreted as a shell command. Ftp then forks
a shell, using popen(3) with the argument supplied, and reads
from (writes to) stdout (stdin). If the shell command includes
spaces, the argument must be quoted; e.g. ‘‘" ls -lt"’’. A
particularly useful example of this mechanism is: ‘‘dir more’’.
3. Failing the above checks, if ‘‘globbing’’ is enabled, local file
names are expanded according to the rules used in csh(1); c.f.
the glob command. If the ftp command expects a single local
file (.e.g. put), only the first filename generated by the
‘‘globbing’’ operation is used.
4. For mget commands and get commands with unspecified local file
4. For mget commands and get commands with unspecified local file
Удалитьnames, the local filename is the remote filename, which may be
altered by a case, ntrans, or nmap setting. The resulting file-
name may then be altered if runique is on.
5. For mput commands and put commands with unspecified remote file
names, the remote filename is the local filename, which may be
altered by a ntrans or nmap setting. The resulting filename may
then be altered by the remote server if sunique is on.
FILE TRANSFER PARAMETERS
The FTP specification specifies many parameters which may affect a file
transfer. The type may be one of ‘‘ascii’’, ‘‘image’’ (binary),
‘‘ebcdic’’, and ‘‘local byte size’’ (mostly for PDP-10’s and PDP-20’s).
Ftp supports the ascii and image types of file transfer, plus local
byte size 8 for tenex mode transfers.
Ftp supports only the default values for the remaining file transfer
parameters: mode, form, and struct.
THE .netrc FILE
The .netrc file contains login and initialization information used by
the auto-login process. It resides in the user’s home directory. The
following tokens are recognized; they may be separated by spaces, tabs,
or new-lines:
machine name
Identify a remote machine name. The auto-login process searches
the .netrc file for a machine token that matches the remote
machine specified on the ftp command line or as an open command
argument. Once a match is made, the subsequent .netrc tokens
are processed, stopping when the end of file is reached or
another machine or a default token is encountered.
default
This is the same as machine name except that default matches any
name. There can be only one default token, and it must be after
all machine tokens. This is normally used as:
default login anonymous password user@site
hereby giving the user automatic anonymous ftp login to
Удалитьmachines not specified in .netrc. This can be overridden by
using the -n flag to disable auto-login.
login name
Identify a user on the remote machine. If this token is
present, the auto-login process will initiate a login using the
specified name.
password string
Supply a password. If this token is present, the auto-login
process will supply the specified string if the remote server
requires a password as part of the login process. Note that if
this token is present in the .netrc file for any user other than
anonymous, ftp will abort the auto-login process if the .netrc
is readable by anyone besides the user.
account string
Supply an additional account password. If this token is
present, the auto-login process will supply the specified string
if the remote server requires an additional account password, or
the auto-login process will initiate an ACCT command if it does
not.
macdef name
Define a macro. This token functions like the ftp macdef com-
mand functions. A macro is defined with the specified name; its
contents begin with the next .netrc line and continue until a
null line (consecutive new-line characters) is encountered. If
a macro named init is defined, it is automatically executed as
the last step in the auto-login process.
ENVIRONMENT
Ftp utilizes the following environment variables.
HOME For default location of a .netrc file, if one exists.
SHELL For default shell.
SEE ALSO
Удалитьftpd(8)
Lunt, S. J., FTP Security Extensions, Internet Draft, November 1993.
HISTORY
The ftp command appeared in 4.2BSD.
BUGS
Correct execution of many commands depends upon proper behavior by the
remote server.
An error in the treatment of carriage returns in the 4.2BSD ascii-mode
transfer code has been corrected. This correction may result in incor-
rect transfers of binary files to and from 4.2BSD servers using the
ascii type. Avoid this problem by using the binary image type.
FTP(1)
(END)
VSFTPD(8) BSD System Manager’s Manual VSFTPD(8)
ОтветитьУдалитьNAME
vsftpd - Very Secure FTP Daemon
SYNOPSIS
vsftpd [configuration file]
DESCRIPTION
vsftpd is the Very Secure File Transfer Protocol Daemon. The server can
be launched via a “super-server” such as inetd(8) or xinetd(8). Alter-
natively, vsftpd can be launched in standalone mode, in which case
vsftpd itself will listen on the network. This latter mode is easier to
use, and recommended. It is activated by setting listen=YES in
/etc/vsftpd/vsftpd.conf. Direct execution of the vsftpd binary will
then launch the FTP service ready for immediate client connections.
OPTIONS
An optional [configuration file] may be given on the command line. This
configuration file has to be owned by root. The default configuration
file is /etc/vsftpd/vsftpd.conf.
SEE ALSO
vsftpd.conf(5)
BSD March 8, 2001 BSD
(END)
getedit /etc/rc.d/init.d/vsftpd
ОтветитьУдалить#!/bin/bash
#
# vsftpd This shell script takes care of starting and stopping
# standalone vsftpd.
#
# chkconfig: - 60 50
# description: Vsftpd is a ftp daemon, which is the program \
# that answers incoming ftp service requests.
# processname: vsftpd
# config: /etc/vsftpd/vsftpd.conf
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
RETVAL=0
prog="vsftpd"
start() {
# Start daemons.
[ -x /usr/sbin/vsftpd ] || exit 4
CONFS=`ls /etc/vsftpd/*.conf 2>/dev/null`
[ -z "$CONFS" ] && exit 6
for i in $CONFS; do
site=`basename $i .conf`
echo -n $"Starting $prog for $site: "
daemon /usr/sbin/vsftpd $i
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
echo
done
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Shutting down $prog: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
[root@localhost ~]# chkconfig --list
ОтветитьУдалитьNetworkManager 0:off 1:off 2:on 3:on 4:on 5:on 6:off
acpid 0:off 1:off 2:on 3:on 4:on 5:on 6:off
amd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
anacron 0:off 1:off 2:on 3:on 4:on 5:on 6:off
atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
autofs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
avahi-daemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off
avahi-dnsconfd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
bluetooth 0:off 1:off 2:on 3:on 4:on 5:on 6:off
capi 0:off 1:off 2:off 3:off 4:off 5:off 6:off
conman 0:off 1:off 2:off 3:off 4:off 5:off 6:off
cpuspeed 0:off 1:on 2:on 3:on 4:on 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
cups 0:off 1:off 2:on 3:on 4:on 5:on 6:off
dc_client 0:off 1:off 2:off 3:off 4:off 5:off 6:off
dc_server 0:off 1:off 2:off 3:off 4:off 5:off 6:off
dnsmasq 0:off 1:off 2:off 3:off 4:off 5:off 6:off
dovecot 0:off 1:off 2:off 3:off 4:off 5:off 6:off
dund 0:off 1:off 2:off 3:off 4:off 5:off 6:off
firstboot 0:off 1:off 2:off 3:on 4:off 5:on 6:off
gpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off
haldaemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off
hidd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
hplip 0:off 1:off 2:on 3:on 4:on 5:on 6:off
httpd 0:off 1:off 2:off 3:off 4:off 5:on 6:off
innd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
irda 0:off 1:off 2:off 3:off 4:off 5:off 6:off
irqbalance 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iscsi 0:off 1:off 2:off 3:on 4:on 5:on 6:off
iscsid 0:off 1:off 2:off 3:on 4:on 5:on 6:off
isdn 0:off 1:off 2:on 3:on 4:on 5:on 6:off
kudzu 0:off 1:off 2:off 3:on 4:on 5:on 6:off
xinetd based services:
Удалитьchargen-dgram: off
chargen-stream: off
daytime-dgram: off
daytime-stream: off
discard-dgram: off
discard-stream: off
echo-dgram: off
echo-stream: off
eklogin: off
ekrb5-telnet: off
gssftp: off
klogin: off
krb5-telnet: off
kshell: off
rsync: off
tcpmux-server: off
time-dgram: off
time-stream: off
Два предыдущих комментария, результат выполнения chkconfig --list, а еще у нее опции
Удалить[root@localhost ~]# chkconfig --help
chkconfig version 1.3.30.2 - Copyright (C) 1997-2000 Red Hat, Inc.
This may be freely redistributed under the terms of the GNU Public License.
usage: chkconfig --list [name]
chkconfig --add
chkconfig --del
chkconfig [--level ]
Пожалуй, лучше дописать все уровни у меня в компьютере (продолжение)
Удалить[root@localhost ~]# chkconfig --list
..........(начало выше)
lm_sensors 0:off 1:off 2:on 3:on 4:on 5:on 6:off
lvm2-monitor 0:off 1:on 2:on 3:on 4:on 5:on 6:off
mcstrans 0:off 1:off 2:on 3:on 4:on 5:on 6:off
mdmonitor 0:off 1:off 2:on 3:on 4:on 5:on 6:off
mdmpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
messagebus 0:off 1:off 2:off 3:on 4:on 5:on 6:off
microcode_ctl 0:off 1:off 2:on 3:on 4:on 5:on 6:off
multipathd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
named 0:off 1:off 2:off 3:off 4:off 5:off 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
netplugd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
nscd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
ntpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
oddjobd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
pand 0:off 1:off 2:off 3:off 4:off 5:off 6:off
pcscd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
portmap 0:off 1:off 2:off 3:on 4:on 5:on 6:off
psacct 0:off 1:off 2:off 3:off 4:off 5:off 6:off
rawdevices 0:off 1:off 2:off 3:on 4:on 5:on 6:off
rdisc 0:off 1:off 2:off 3:off 4:off 5:off 6:off
readahead_early 0:off 1:off 2:on 3:on 4:on 5:on 6:off
readahead_later 0:off 1:off 2:off 3:off 4:off 5:on 6:off
restorecond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
rpcgssd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
rpcidmapd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
rpcsvcgssd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
rwhod 0:off 1:off 2:off 3:off 4:off 5:off 6:off
saslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
sendmail 0:off 1:off 2:on 3:on 4:on 5:on 6:off
smartd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
smb 0:off 1:off 2:off 3:off 4:off 5:off 6:off
spamassassin 0:off 1:off 2:off 3:off 4:off 5:off 6:off
squid 0:off 1:off 2:off 3:off 4:off 5:off 6:off
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
syslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
tcsd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
tux 0:off 1:off 2:off 3:off 4:off 5:off 6:off
vncserver 0:off 1:off 2:off 3:off 4:off 5:off 6:off
vsftpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
wdaemon 0:off 1:off 2:off 3:off 4:off 5:off 6:off
winbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off
wpa_supplicant 0:off 1:off 2:off 3:off 4:off 5:off 6:off
xfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
xinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
ypbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off
yum-updatesd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
команда init -уровень выполнения - http://ru.wikipedia.org/wiki/%D0%A3%D1%80%D0%BE%D0%B2%D0%B5%D0%BD%D1%8C_%D0%B2%D1%8B%D0%BF%D0%BE%D0%BB%D0%BD%D0%B5%D0%BD%D0%B8%D1%8F
ОтветитьУдалитьВ различных дистрибутивах Linux уровни выполнения используются для различных целей.
Современная версия программы init может использовать десять уровней выполнения, но обычно используются только семь.
0 — выполняются действия по выключению системы.
1 — однопользовательский режим (single user mode). Предназначен для различных административных действий по восстановлению системы. По своему смыслу аналогичен Safe Mode Windows, но полностью его не повторяет. На этом уровне выполнения система полностью сконфигурирована, но не запущен ни один сервис, а из пользователей может работать только один root.
2 — не используется, но сконфигурирован как уровень выполнения 3. В RedHat и SuSE Linux сконфигурирован как уровень выполнения 3, но без поддержки сетевых файловых систем. В Debian используется как многопользовательский режим.
3 — многопользовательский режим (multiuser mode). Нормальный режим работы сервера.
4 — В Slackware Linux используется для графического входа в систему. В RedHat и SuSE Linux не сконфигурирован.
5 — В RedHat и SuSE Linux используется для графического входа в систему. В Slackware Linux не сконфигурирован.
6 — выполняются действия по перезагрузке системы.
Суперпользователь может остановить систему, переведя её на нулевой уровень:
В любой момент времени проверить текущий уровень можно командой runlevel:
Удалить/sbin/runlevel
N 5 (у меня в ноутбуке Centos)
Команад для просмотра сетевых соединений, здесьесть ftp
ОтветитьУдалить[root@localhost ~]# netstat -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost.localdomain:2208 *:* LISTEN
tcp 0 0 *:970 *:* LISTEN
tcp 0 0 *:sunrpc *:* LISTEN
tcp 0 0 *:ftp *:* LISTEN
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 localhost.localdomain:ipp *:* LISTEN
tcp 0 0 localhost.localdomain:smtp *:* LISTEN
tcp 0 0 localhost.localdomain:2207 *:* LISTEN
tcp 0 0 192.168.1.51:36201 a23-62-99-137.deploy.a:http TIME_WAIT
tcp 0 0 192.168.1.51:45906 69.59.197.29:http ESTABLISHED
tcp 0 0 192.168.1.51:39404 la-in-f189.1e100.net:https ESTABLISHED
tcp 0 0 192.168.1.51:39402 la-in-f189.1e100.net:https TIME_WAIT
tcp 0 0 192.168.1.51:60144 plus.google.com:https ESTABLISHED
tcp 0 0 *:http *:* LISTEN
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 *:https *:* LISTEN
udp 0 0 *:bootpc *:*
udp 0 0 *:964 *:*
udp 0 0 *:967 *:*
udp 0 0 *:44629 *:*
udp 0 0 *:mdns *:*
udp 0 0 *:sunrpc *:*
udp 0 0 *:ipp *:*
udp 0 0 localhost.localdomain:ntp *:*
udp 0 0 *:ntp *:*
udp 0 0 *:mdns *:*
udp 0 0 *:58227 *:*
udp 0 0 localhost6.localdomain6:ntp *:*
udp 0 0 *:ntp *:*
Надо было соединятся так:
ОтветитьУдалить[root@localhost vsftpd]# ftp localhost
Connected to localhost.localdomain.
220 Welcome to blah FTP service.
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (localhost:root): Altersego
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ?
Commands may be abbreviated. Commands are:
! cr mdir proxy send
$ delete mget sendport site
account debug mkdir put size
append dir mls pwd stat us
ascii disconnect mode quit stru ct
bell form modtime quote syst em
binary get mput recv suni que
bye glob newer reget tene x
case hash nmap rstatus trac e
ccc help nlist rhelp type
cd idle ntrans rename user
cdup image open reset umas k
chmod lcd passive restart verb ose
clear ls private rmdir ?
close macdef prompt runique
cprotect mdelete protect safe
Для того, чтобы соединение стало возможным не нужно было редактировать конфигурационный файл:
Удалить# gedit etc/vsftpd/vsftpd.conf
или сразу в bash (см. ниже)
[root@localhost vsftpd]# cat vsftpd.conf
ОтветитьУдалить# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out)
.
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you wil
l
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# The target log file can be vsftpd_log_file or xferlog_file.
# This depends on setting xferlog_std_format parameter
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# The name of log file when xferlog_enable=YES and xferlog_std_format=YES
# WARNING - changing this filename affects /etc/logrotate.d/vsftpd.log
#xferlog_file=/var/log/xferlog
#
# Switches between logging into vsftpd_log_file and xferlog_file files.
# NO writes to vsftpd_log_file, YES to xferlog_file
xferlog_std_format=YES
#
Удалить# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCI
I
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparentl y
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assum e
# the presence of the "-R" option, so there is a strong case for enabling it .
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IP v6
# sockets, you must run two copies of vsftpd whith two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
Итак, в конфигурационном файле выше я только раскомментировал баннер, так что теперь выскакивает надпись, которую, кстати надо бы поменять
ОтветитьУдалить# You may fully customise the login banner string:
ftpd_banner=Welcome to blah FTP service.
А все остальные настройки оставил по умолчанию
Но после успешного входа локальный пользователь Altersego не может увидеть содержание каталога var/www/
ОтветитьУдалитьНадо разобраться с настройками для специальных и анонимных пользователей...
У анонимного юзера нет пароля, а сам он называется anonymous(см /etc/vsftpd/vsftpd.conf), потому при анонимном входе достаточно на запрос пароля нажать клавишу "Enter"
ОтветитьУдалить[root@localhost vsftpd]# ftp localhost
Connected to localhost.localdomain.
220 Welcome to blah FTP service.
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (localhost:root): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
Анонимный юзер может только подключиться, но ничего более???
Удалитьftp> pwd
257 "/"
ftp> cd var
550 Failed to change directory.
ftp> ls
227 Entering Passive Mode (127,0,0,1,118,174)
150 Here comes the directory listing.
drwxr-xr-x 2 0 0 4096 Jan 09 09:59 pub
226 Directory send OK.
ftp> cd home
550 Failed to change directory.
ftp>
Я пробовал запускать
ОтветитьУдалитьservice vsftpd start
OK
То потом при выполнении проверки не получал, того, что полагалось
# chkconfig --list vsftpd
vsftpd 0:выкл 1:выкл 2:вкл 3:вкл 4:вкл 5:вкл 6:выкл
Вместо этого у меня все было выключено, я не хотел включать vsftpd как демон, но все же сделал это через графический интерфейс System -> Administration -> Server settings -> Servises
полсе этого получил
# chkconfig --list vsftpd
vsftpd 0:выкл 1:выкл 2:выкл 3:выкл 4:выкл 5:вкл 6:выкл
http://www.linuxquestions.org/questions/linux-general-1/creating-vsftpd-full-permission-user-to-var-www-html-397600/
ОтветитьУдалитьЗдесь в ответ на этот вопрос выдается очевидная (но не для меня) идея
Hi All,
I want to create a vsftpd user - user1 which needs full acces to /var/www/html which will be the home directory also.
The owner of /var/www/html is user owner1 and owner1.
Please help me to make a ftp user user1 which has full permission to /var/www/html
Regards, Vibin.
It's probably better to make the user's home directory under the
Удалить/home directory.
There are usually a bunch of files in a home directory (especially if you log in using a gui). If you create the user the same way you've created other users,
then create another group (maybe called ftpuser),
then chgrp /var/www/html to ftpuser
and give the ftpuser group write permissions to /var/www/html you should get the same result.
Thanks glead, it worked. I just added the new user to apache group and gave the html folder writable for the group, is it fine? any security risk?
УдалитьBut can u advice the cmd to make www as the ftp root folder when the user log in using vsftp, now its logging to the user home folder which is the default.
Thanks Again, Vibin.
Having the web user as a member of the same group as the group owning the web server files is not a problem. The easiest way to get to the web server files quickly from the home directory is to create a link:
УдалитьCode:
ln -s /var/www/html /home/user/html
Now when you ftp into the box your default directory is still your home directory (/home/user), but when you type `cd html` you will be at /var/www/html
Will that do what you want it to?
Ну вот, наконец-то нашел:
ОтветитьУдалить1. В обсуждении Can't get vsftpd working!!!
http://www.linuxquestions.org/questions/linux-server-73/cant-get-vsftpd-working-927225/
Есть подробные рекомендации по установке
Here is what I do for hosted CentOS servers, I have multiple domains on servers with email, ftp and such.
You can use the directory of /var/www create a directory call webdata or the like.
И, наконец, есть ссылка на документацию redhat.com
https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Managing_Confined_Services/chap-Managing_Confined_Services-File_Transfer_Protocol.html
Здесь, оказывается есть настройки по умолчанию... и есть еще SELinux настройки...
Словом, надо искать родную документацию (в первую очередь), поскольку сборки отличаются..., потом блоги и форумы (опять же, сначала под RedHat, а не Centos - вот моя главная ошибка)
В руководстве https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Managing_Confined_Services/chap-Managing_Confined_Services-File_Transfer_Protocol.html
ОтветитьУдалитьиспользуется комманда
NAME
setsebool - set SELinux boolean value
SYNOPSIS
setsebool [ -P ] boolean value | bool1=val1 bool2=val2 ...
DESCRIPTION
setsebool sets the current state of a particular SELinux boolean or a list of
booleans to a given value. The value may be 1 or true or on to enable the
boolean, or 0 or false or off to disable it.
Without the -P option, only the current boolean value is affected; the boot-
time default settings are not changed.
If the -P option is given, all pending values are written to the policy file on
disk. So they will be persistant across reboots.
AUTHOR
This manual page was written by Dan Walsh . The program was
written by Tresys Technology.
SEE ALSO
getsebool(8), booleans(8), togglesebool(8)
dwalsh@redhat.com 11 Aug 2004 setsebool(8)
Для диагностики SELinux http://www.linuxquestions.org/questions/linux-server-73/cant-get-vsftpd-working-927225/ рекомендуют установить
ОтветитьУдалитьIf selinux is enabled see if this package is installed
rpm -q setroubleshoot
if it is not do: yum install setroubleshoot
then you can do this:
sealert -a /var/log/audit/audit.log|less
and you see any denial messages
you can also do this to put selinux in a permissive mode:
# setenforce 0
# getenforce (you should get this output)
Permissive
При одновременном входе из двух терминалов и под root под пользователем Altersego в папке видны только три папки владельца root
ОтветитьУдалить[Altersego@localhost ~]$ ftp localhost
Connected to localhost.localdomain.
220 Welcome to blah FTP service.
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (localhost:Altersego):
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (127,0,0,1,28,235)
150 Here comes the directory listing.
drwxr-xr-x 3 0 0 4096 Feb 03 2011 0SE-new
drwxr-xr-x 3 0 0 4096 Nov 24 2011 Centos
drwxr-xr-x 3 0 0 4096 Nov 24 2011 Mymirror,Centos5updates
226 Directory send OK.
ftp>
An SELinux denial similar to the following is logged:
Удалитьsetroubleshoot: SELinux is preventing the ftp daemon from reading users home directories (username). For complete SELinux messages. run
sealert -l c366e889-2553-4c16-b73f-92f36a1730ce
Access to home directories has been denied by SELinux. This can be fixed by activating the ftp_home_dir Boolean. Enable this ftp_home_dir Boolean by running the following command as the root user:
Удалить# setsebool -P ftp_home_dir=1
Do not use the -P option if you do not want changes to persist across reboots.
УдалитьTry to log in again. Now that SELinux is allowing access to home directories via the ftp_home_dir Boolean, logging in will succeed.
Простое вдиео по настройке http://www.youtube.com/watch?v=kt9LmIXMBi0
ОтветитьУдалитьПод ним все расписано:
Published on Dec 17, 2012
How to Install and Configure ftp server in Linux
1) Install vsftpd rpm if its not present
rpm -qa | grep -i vsftpd
yum install vsftpd
rpm -ivh vsftpdxxxxx.rpm
2) edit the vsftpd.conf file in /etc/vsftpd
Uncomment this to allow local users to log in.
local_enable=YES
to allow ftp uploads
write_enable=YES
3) Edit the ftpuser and user_list file in /etc/vsftpd
and remove the particular user which you are using for ftp
3) Start ftp service
service vsftpd start
to configure ftp on startup #chkconfig vsftpd on
4) If SELINUX is enabled then Access to home directories is denied by SELinux.
This can be fixed by activating the ftp_home_dir Boolean.
setsebool -P ftp_home_dir=1
5) try connecting from any ftp client
The following Booleans allow you to tell SELinux how you are running vsftpd:
Удалитьallow_ftpd_anon_write When disabled, this Boolean prevents vsftpd from writing to files and directories labeled with the public_content_rw_t type. Turn this Boolean on to allow users to upload files via FTP. The directory where files are uploaded to must be labeled with the public_content_rw_t type and Linux permissions set accordingly.
allow_ftpd_full_access When this Boolean is on, only Linux (DAC) permissions are used to control access, and authenticated users can read and write to files that are not labeled with the public_content_t or public_content_rw_t types.
allow_ftpd_use_cifs Having this Boolean enabled allows vsftpd to access files and directories labeled with the cifs_t type; therefore, having this Boolean enabled allows you to share file systems mounted via Samba through vsftpd.
allow_ftpd_use_nfs Having this Boolean enabled allows vsftpd to access files and directories labeled with the nfs_t type; therefore, having this Boolean enabled allows you to share file systems mounted via NFS through vsftpd.
ftp_home_dir Having this Boolean enabled allows authenticated users to read and write to files in their home directories. When this Boolean is off, attempting to download a file from a home directory results in an error such as 550 Failed to open file. An SELinux denial is logged.
ftpd_connect_db Allow FTP daemons to initiate a connection to a database.
httpd_enable_ftp_server Allow httpd to listen on the FTP port and act as a FTP server.
tftp_anon_write Having this Boolean enabled allows TFTP access to a public directory, such as an area reserved for common files that otherwise has no special access restrictions.
https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/htm...
http://www.youtube.com/watch?v=Ck9C__zB6Ok
ОтветитьУдалитьIf SELINUX is enabled
# iptables -F
#getsebool -a | grep ftpd_disable_trans
--flush -F [chain] Delete all rules in chain or all chains
getsebool(8) SELinux Command Line documentation getsebool(8)
NAME
getsebool - get SELinux boolean value(s)
SYNOPSIS
getsebool [-a] [boolean]
DESCRIPTION
getsebool reports where a particular SELinux boolean or all SELinux
booleans are on or off In certain situations a boolean can be in one
state with a pending change to the other state. getsebool will report
this as a pending change. The pending value indicates the value that
will be applied upon the next boolean commit.
The setting of boolean values occurs in two stages; first the pending
value is changed, then the booleans are committed, causing their active
values to become their pending values. This allows a group of booleans
to be changed in a single transaction, by setting all of their pending
values as desired and then committing once.
OPTIONS
-a Show all SELinux booleans.
SEE ALSO
selinux(8), setsebool(8), booleans(8)
AUTHOR
This manual page was written by Dan Walsh . The
program was written by Tresys Technology.
dwalsh@redhat.com 11 Aug 2004 getsebool(8)
if the SELinux Security is ON, than we need to bring down booleans of FTP Server ... by following commands:
Удалить# iptables -F
#getsebool -a | grep ftpd_disable_trans
it will promt us a current status of ftp bollean which is OFF at that time&
we need to make it ON
# setsebool ftpd_disable_trans=1
...
#getsebool -a | grep ftpd_disable_trans
Потом создаем нового юзера (с паролем)
ОтветитьУдалить[root@localhost ~]# hostname
localhost.localdomain
# useradd Boba
# password Boba
Другое видео 12 минут http://www.youtube.com/watch?v=SiiFFy1M4jU
ОтветитьУдалить1. Устанавливаем сервер (ibuntu)
2. Смотрим сеть коммандой:
[root@localhost ~]# netstat -a |grep ftp
tcp 0 0 *:ftp *:* LISTEN
Это у меня, а у него есть еще две строчки
tcp 15 0 mypage:59671 mypage:ftp CLOSE_WAIT
Предыдущее видео с другим пакетом, потому нашел три http://www.youtube.com/watch?v=wiA1fpR3Nx4
ОтветитьУдалитьи подсмотрел у них комманду для просмотра установленного пакета, вот что у меня показывает:
в[root@localhost ~]# rpm -ql vsftpd
/etc/logrotate.d/vsftpd.log
/etc/pam.d/vsftpd
/etc/rc.d/init.d/vsftpd
/etc/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
/etc/vsftpd/vsftpd_conf_migrate.sh
/usr/sbin/vsftpd
/usr/share/doc/vsftpd-2.0.5
/usr/share/doc/vsftpd-2.0.5/AUDIT
/usr/share/doc/vsftpd-2.0.5/BENCHMARKS
/usr/share/doc/vsftpd-2.0.5/BUGS
/usr/share/doc/vsftpd-2.0.5/COPYING
/usr/share/doc/vsftpd-2.0.5/Changelog
/usr/share/doc/vsftpd-2.0.5/EXAMPLE
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE/vsftpd.conf
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE/vsftpd.xinetd
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE/vsftpd.xinetd.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE_NOINETD
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE_NOINETD/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE_NOINETD/README.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/PER_IP_CONFIG
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/PER_IP_CONFIG/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/PER_IP_CONFIG/README.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/PER_IP_CONFIG/hosts.allow
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/PER_IP_CONFIG/hosts.allow.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_HOSTS
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_HOSTS/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/README.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/logins.txt
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/vsftpd.conf
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/vsftpd.pam
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/vsftpd.pam.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS_2
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS_2/README
/usr/share/doc/vsftpd-2.0.5/FAQ
/usr/share/doc/vsftpd-2.0.5/INSTALL
/usr/share/doc/vsftpd-2.0.5/LICENSE
/usr/share/doc/vsftpd-2.0.5/README
/usr/share/doc/vsftpd-2.0.5/README.security
/usr/share/doc/vsftpd-2.0.5/REWARD
/usr/share/doc/vsftpd-2.0.5/SECURITY
/usr/share/doc/vsftpd-2.0.5/SECURITY/DESIGN
/usr/share/doc/vsftpd-2.0.5/SECURITY/IMPLEMENTATION
/usr/share/doc/vsftpd-2.0.5/SECURITY/OVERVIEW
/usr/share/doc/vsftpd-2.0.5/SECURITY/TRUST
/usr/share/doc/vsftpd-2.0.5/SIZE
/usr/share/doc/vsftpd-2.0.5/SPEED
/usr/share/doc/vsftpd-2.0.5/TODO
/usr/share/doc/vsftpd-2.0.5/TUNING
/usr/share/doc/vsftpd-2.0.5/vsftpd.xinetd
/usr/share/man/man5/vsftpd.conf.5.gz
/usr/share/man/man8/vsftpd.8.gz
/var/ftp
/var/ftp/pub
[root@localhost policy]# getenforce
ОтветитьУдалитьEnforcing
[root@localhost policy]# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 21
Policy from config file: targeted
[root@localhost policy]# setenforce 0
[root@localhost policy]# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: permissive
Mode from config file: enforcing
Policy version: 21
Policy from config file: targeted