SlideShare une entreprise Scribd logo
1  sur  14
Télécharger pour lire hors ligne
1
【Linux】#2 FTP
アジェンダ
0900〜0915 PCのセットアップと物理結線
0915〜0930 vmwareでの設定
0930〜0945 CentOSインストール準備
0945〜1000 SElinux
1000〜1015 Firewall
1015〜1030 sshポート変更
仮想マシンの名前
connpassIDの先頭4文字+【study】+linux1 として下さい。
鈴⽊の場合、Fors【study】linux1になります。
今日出来るようになる事
「dnf」コマンドでのローカルインストール、デーモンの起動と停止
「ps –aux | grep」プロセス確認
ゴール
FTPをインストールする
FTPサイトを作成する
PC1
192.168.210.11
PC2
192.168.210.12
PC3
192.168.210.13
vmware
192.168.210.200
PC4
192.168.210.14
Port#1
Server1
192.168.210.111
Server1
192.168.210.112
2 【講義】FTP TFTP FTPS SFTP
どんな時に使う︖
FTP 信頼できる人にファイルを渡す時
FTPサイト / ID / パスワード を利⽤して、⼤容量のファイルを「サクサク」落したい時
CentOS、WindowsServer、CiscoIOS OSをバージョン違いで保管
検証時、機器故障保守交換対応時に必要バージョンを落とす
社内ライブラリから
FTPソフトによる違いあるの︖
HTPPSとのスピード差
スニファしないで
TFTP ネットワーク機器(Cisco、Foritigate)OSをアップデートする時 認証なしで、ファイルを送信する
ネットワーク技術者が利⽤する
FTPS 途中の通信を暗号化したい時
FTPサーバが証明書を要求している時
クライアント (暗号化)→ 途中 → サーバ(複合化)
証明書が必要
通信を暗号化するなら、拠点間VPNが楽ちんでは︖
989と990
SFTP teratermを使いながら、少量のファイルをサーバにアップロードする時 22
インターネット未接続環境でのdnf
ソフトウェアのインストールにはCentOS8のパッケージ管理ソフトウェアである「dnf」を使⽤していきますが、デフォルトではインターネットからソフト
ウェアを取得することになります。
ここではインストールメディアからソフトウェアを取得する設定を⾏います。
インストールメディアのISOイメージをCDROMドライブにセットしてあります。
3
手順1
#mkdir␣/media/CentOS
#mount␣–o␣ro␣/dev/cdrom␣/media/CentOS/
alias␣dnf=‘dnf␣--disablerepo=¥*␣--enablerepo=c8-media-BaseOS,c8-media-AppStream’
手順2 確認
[root@suzukto ~]# df
ファイルシス 1K-ブロック 使⽤ 使⽤可 使⽤% マウント位置
devtmpfs 905304 0 905304 0% /dev
tmpfs 934792 0 934792 0% /dev/shm
tmpfs 934792 9832 924960 2% /run
tmpfs 934792 0 934792 0% /sys/fs/cgroup
/dev/mapper/cl-root 13420544 4243772 9176772 32% /
/dev/sda2 999320 191708 738800 21% /boot
/dev/sda1 613184 6908 606276 2% /boot/efi
tmpfs 186956 1180 185776 1% /run/user/42
tmpfs 186956 4672 182284 3% /run/user/0
/dev/sr0 8037456 8037456 0 100% /media/CentOS
[root@suzukto ~]#
#alias
手順3 確認
[root@suzukto ~]# alias
alias cp='cp -i'
alias dnf=‘dnf --disablerepo=¥* --enablerepo=c8-media-BaseOS,c8-media-
AppStream’ ←確認
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
[root@suzukto ~]#
FTPサーバーのインストールと設定 (1)
FTPサーバーソフトウェア vsftpd のインストール
dnf list vsftpd
「利⽤可能なパッケージ」として表⽰されることを確認します。
dnf install vsftpd
インストールコマンド。dnfコマンドの初回実⾏時にはインストール元の検証のための鍵がインポートされます。
「完了しました!」と表⽰されたらインストール完了です。
4
利用可能なパッケージ
vsftpd.x86_64 3.0.3-31.el8 AppStream
警告: /var/cache/dnf/AppStream-a520ed22b0a8a736/packages/vsftpd-3.0.3-31.el8.x86_64.rpm: ヘッダー V3 RSA/SHA256
Signature、鍵 ID 8483c65d: NOKEY
CentOS-8 - AppStream 41 kB/s | 1.6 kB 00:00
GPG 鍵 0x8483C65D をインポート中:
Userid : "CentOS (CentOS Official Signing Key) <security@centos.org>"
Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
これでよろしいですか? [y/N]: y
手順4 [root@suzukto ~]# dnf␣list␣vsftpd
手順5 [root@suzukto ~]# dnf␣install␣vsftpd
FTPサーバーのインストールと設定 (1)
手順6 vftpd のインストールの確認
手順7 サービス起動の確認をします。停止状態を確認します。
手順8 起動させ起動状態を確認します。
5
[root@suzukto ~]# vsftpd -v
vsftpd: version 3.0.3
[root@suzukto ~]# systemctl␣status␣vsftpd
● vsftpd.service - Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
[root@suzukto ~]# systemctl␣start␣vsftpd
[root@suzukto ~]# systemctl␣status␣vsftpd
● vsftpd.service - Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-11-11 00:08:23 JST; 17s ago
FTPサーバーのインストールと設定 (3)
手順9 FTPサーバーの自動起動設定
systemctl status vsftpd
下線部分が「disabled」の場合、OS起動時に自動起動されません。
systemctl enable vsftpd
OS起動時に自動起動されるようにします。コマンド実⾏後、再度「systemctl status vsftpd」で確認してください。
6
● vsftpd.service - Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-11-11 00:08:23 JST; 17s ago
● vsftpd.service - Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2020-11-11 00:08:23 JST; 4s ago
systemctl␣status␣vsftpd
systemctl␣enable␣vsftpd
[root@CentOS8-1 ~]# ps -aux | grep vsftpd
root 3752 0.0 0.0 27016 416 ? Ss 09:03 0:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
root 4092 0.0 0.0 10280 988 pts/1 R+ 09:12 0:00 grep --color=auto vsftpd
FTPサーバーへのアクセス (1)
手順10 FTPクライアントのインストール
dnf install ftp
最小インストール構成の場合、FTPクライアントであるftpコマンドがインストールされていないため追加します。
手順11 ファイアウォールの設定
firewall-cmd
CentOS8のファイアウォール設定ではFTP関連ポートがサービスとして定義されているため、このコマンドで次の通信が許可されます。
tcp/21、およびFTPデータ通信⽤ポート(動的)
firewall-cmd –-list-all
現在の設定が表⽰されます。「services: ftp」が含まれていることを確認してください。
firewall-cmd --runtime-to-permanent
現在の設定をOS再起動時に読み込まれるようにします。
7
dnf␣install␣ftp
firewall-cmd␣--add-service=ftp
firewall-cmd␣--list-all
firewall-cmd␣--runtime-to-permanent
FTPサーバーへのアクセス (2)
手順12 FTPクライアントからのアクセス
自サーバーのFTPサービスへ接続
ユーザー名、パスワードを⼊⼒するとログインできます
手順13 今日の日付のファイル+connpassアカウントを作成して好きなゲームの種類
を書いてください。好きなゲームがない場合は、好きな飲み物でも(なんでも)
手順14 ファイルをアップロードします。
Fromに作成したファイル、Toに FTPのホームディレクトリ、Send
8
# ftp localhost
Trying ::1...
Connected to localhost (::1).
220 (vsFTPd 3.0.3)
Name (localhost:root): username
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> quit
221 Goodbye.
ftp␣localhost
ftp> pwd
257 "/home/suzukito" is the current directory
FTPサーバーへのアクセス (2)
手順15 ファイルがアップロード出来たことを確認して下さい
手順16 相方接続⽤のユーザを作成します
ユーザ名︓connpassアカウント パスワード︓ connpassアカウント(同じ)
手順17 相方のftp接続します。
FireWall設定が問題なければ、ID / パスワードで接続できます。
9
ftp> ls -al
229 Entering Extended Passive Mode (|||30603|)
150 Here comes the directory listing.
drwx------ 3 1000 1000 119 Dec 29 02:03 .
drwxr-xr-x 3 0 0 22 Dec 19 15:55 ..
-rw------- 1 1000 1000 5 Dec 29 01:29 .bash_history
-rw-r--r-- 1 1000 1000 18 Nov 08 2019 .bash_logout
-rw-r--r-- 1 1000 1000 141 Nov 08 2019 .bash_profile
-rw-r--r-- 1 1000 1000 312 Nov 08 2019 .bashrc
-rw-r--r-- 1 0 0 10 Dec 29 2020 20201230.txt
226 Directory send OK.
ftp>
自分PC
192.168.210.11
相方PC2
192.168.210.12
自分Server
192.168.210.111
相方Server
192.168.210.112
[root@suzukito vsftpd]# useradd ftpuser
[root@suzukito vsftpd]# passwd ftpuser
FTPサーバーへのアクセス (3)
手順18 Windows端末のFTPクライアントからのアクセス
WindowsPCにFTPクライアント(ffftpやWinSCP等)がインストールされている場合、接続やファイルのアップロー
ド、ダウンロードをしてみてください。
Windows10のエクスプローラーもFTPクライアントとして使⽤できるため、アドレスに「ftp://{IPアドレス}/」を
指定することでもFTPサーバーへアクセスできます。
http://cos.linux-dvr.biz/archives/tag/ftp
10
手順 a-1
仮想マシンを選択して、右クリックから再起動
手順 a-2
手順 a-3
再起動した、コンソールをクリックして選択して、「e」
rhgbを削除 rw init=/bin/sh 追加
「=」はキーボード「^」 ⼊⼒して「ctrl」+X
rootパスワードの初期化その111
手順 a-4
sh-4.4#と表⽰されたら、「passwd」⼊⼒
手順 a-5 パスワードの再⼊⼒
手順 a-6 touch␣/.autorelabel
exec␣/sbin/init
手順 a-7
rootパスワードの初期化その212
時間が余れば、セキュリティ向上(その1)
匿名ユーザの有効化→無効化
13
手順
cp␣-p␣/etc/vsftpd/vsftpd.conf ␣/etc/vsftpd/vsftpd.conf.bak
vi␣/etc/vsftpd/vsftpd.conf
11 # Allow anonymous FTP? (Beware - allowed by default if you comment this out).
12 anonymous_enable=NO ←YESに変えて動きを確認する
13 #
時間が余れば、セキュリティ向上(その2)
chroot
FTPサーバののっとり防止、利⽤者には「監獄」必要なディレクトリだけ
chroot前の接続
14
手順
101 chroot_local_user=YES
102 chroot_list_enable=YES
103 # (default follows)
104 chroot_list_file=/etc/vsftpd/chroot_list

Contenu connexe

En vedette

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming LanguageSimplilearn
 

En vedette (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

Linux#2