I.はじめに
建設および設定プロセスの下でいくつかのピット、またはレコードに、我々は他の人が回り道を避けることを願って後にネットワークセキュリティのニーズは、FTPサーバ実験5実験を設定します。
この記事の下にインストールするとCentOSのLinuxや他のシステムは、他のシステムは、他の記事を参照する必要がインストールし、適用されないためのconfigure LinuxのFTPは、Ubuntuの16でVMware社で行いました。
また、そのアクセス許可の問題に注意し、いくつかのコマンドはので、ここでは基本的にsudoを使用して、実行前にsudoの[元のコマンド]を必要としています。
以下は、テキストです
第二に、基本的なインストール
ftpサーバをインストールします。1.
次のコマンドを実行します。
sudo apt-get update
sudo apt-get install vsftpd
#这里遇到了问题1,解决方案在最下面。
コマンドの後に使用することができvsftpd --version
、インストールバージョンがすでにインストールされているかどうかを検出します。
2. [設定ftpサーバ
(1)バックアップ、一連のコマンドをバックアップする設定ファイルを変更する前に。
sudo cp /etc/vsftpd.conf /etc/vsftpd_bk.conf
(2)設定ファイルを変更します
Vimは、geditの編集を入力するために使用使用することができることができる、私はgeditの操作が比較的簡単であると感じ、したがって本明細書でgeditの使用。(コマンド2は、以下の1から選択されます)
使用sudo vim /etc/vsftpd.conf
またはsudo gedit /etc/vsftpd.conf
(3)設定ファイルの内容を
、ケースの単純な構成(コンフィギュレーションファイルを変更した後に、より詳細な要件について)次のようにIは、構成ファイルvsftpd.confここでした。
listen=NO
listen_ipv6=YES
# Allow anonymous FTP? (Disabled by default).
anonymous_enable=NO
# 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
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# If enabled, vsftpd will display directory listings with the time
# in your local time zone. The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
# You may override where the log file goes if you like. The default is shown
# below.
xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
xferlog_std_format=YES
# You may fully customise the login banner string:
ftpd_banner=Welcome to FTP service.
# 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().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
chroot_local_user=YES
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list
# This option should be the name of a directory which is empty. Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
#
# This string is the name of the PAM service vsftpd will use.
# pam_service_name=vsftpd
pam_service_name=ftp
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
#
# Uncomment this to indicate that vsftpd use a utf8 filesystem.
utf8_filesystem=YES
保存するには、Ctrl + Sを注意してください。
ターミナルの一時的な警告のために(通常は大きな問題を)無視することができます。
第三に、ユーザーを追加
ここでは、ユーザーのT1を追加するには、たとえば、他のユーザーが名前を同じ方法で追加することができます。
1.最初のディレクトリ/ homeにユーザー名を作成します
sudo mkdir /home/t1
2.次に、ユーザのログインディレクトリとシェルをバインド
-Dディレクトリには、コマンドの後の時に-s指定し、ユーザがログインユーザのログインシェルを使用した後に、指定しました
sudo useradd -d /home/t1 -s /bin/bash t1
ユーザーのパスワードT1を追加3.
sudo passwd t1
自分のパスワードを設定した後
4.設定し、所有者の/ home / t1がT1であります
sudo chown t1:t1 /home/t1
/etc/vsftpd.user_listにユーザーを追加5.
行でファイルを開くには、次のコマンドを追加し、T1(つまり、新しいユーザ名である)、保存して終了は述べています。
sudo gedit /etc/vsftpd.user_list
図ファイルは、以下の
行の内容を追加し、/etc/vsftpd.chroot_listにユーザーを追加6も前のステップと同様、T1です。
sudo gedit /etc/vsftpd.chroot_list
サービス再起動する最後の試み
systemctl restart vsftpd
の基本的な設定は完了です
第四に、テスト
1.Ubuntuローカルテストftp localhost
2.Windowsテスト:
(1)内にCMD: ftp IP地址
(2)アドレスバー
また、アドレスバーにあることができるftp:IP地址
かftp://IP地址/
見ます。
正しいユーザー名とパスワードが表示されますを入力した後
私たちは、ファイルを作成していないので、フォルダは、空です。
試験後の3.Ubuntu新しいファイル:
Ubuntuの中に新しいファイルを作成します。
cd /home/t1
sudo gedit test.txt
次の終了を入力します。
そして、窓に見えます
オープンTXT GET
首尾よく、簡単なFTPサーバーを構築しました
第五に、問題が発生しました
1. sudo apt-get update
次のような問題が発生した後にコマンドを実行します。
E: 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用)
E: 无法获取 dpkg 前端锁 (/var/lib/dpkg/lock-frontend),是否有其他进程正占用它?
ソリューション:
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock-frontend
後の場合:
E: 无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)
E: 无法锁定管理目录(/var/lib/dpkg/),是否有其他进程正占用它?
その後:
sudo rm /var/lib/dpkg/lock
全体のプロセスは成功した解像度に従います。