ѾѼԻкȤǤ ѾѼԻθ濴ȤѸβ濴˷Ǻܤޤ񤭻Ϥ᤿ФʤΤǡƤϤޤޤԽʬǤ
ƥꡧ

13.ºݤ > 13.3 Linux

Linux򥤥󥹥ȡ뤹ȡǥեȤWebФưƤ롣
ǰΤᡢƵưƤߤ롣CentOS6
$service httpd restart

ȤʤPC鸫Ƥߤ褦
http://WebФIPɥ쥹

⤷ȡʤ⤷ʤ
ϡSELinuxͭˤʤäƤΤȡФFirewallʤɤʤɤäƤ뤫$system-config-firewallФ

Firewall򳫤ˤϡʲ
httpĤ
firewall-cmd --add-service=http --zone=public --permanent      
--permanent ˤäơ³ŪHTTP򳫤
Ƶư
firewall-cmd --reload  
ǧ
iptables -L -n | grep 80

ƥ
ƥĤ/var/www/html

httpsˤ
եϰʲ
/etc/httpd/conf.d/ssl.conf  

WebФΥ
/var/log/httpd/access_log¸Ƥ롣
ȤƤϤʴ
192.168.1.3 - - [08/Sep/2018:23:36:16 +0900] "GET /  HTTP/1.1" 403 4961 "-" "Mozilla/5.0 (Windows NT 6.3;

ƬIPɥ쥹

MTAȤƤPostfixMUAȤƤdovecotʤΤϡĹǯѤʤʢdovecot᡼ܥåäƤ櫓ǤϤʤdovecotϥ桼Υ᡼׵դ륵ӥ

ɤܤǤ⤤ΤǡȤǤ衣
ϡ¥ƥ֤ϤƤFedoraCore5פ㤤ޤ
ʲƤϾ嵭ܤ򻲾ȤƤޤ

1.sendmail
service sendmail stop

2.PostfixΥ󥹥ȡ
rpmpostfix򥤥󥹥ȡ

3.PostfixĶإå
alternatives --config mta
ǡpostfix򤹤롣

4.main.cf
vi /etc/postfix/main.cf
myhostname = ns1.network-exam.com 
mydomain = network-exam.com
inet_interfaces = allѤNIC
mydestination = $myhostname, localhost.$mydomain, $mydomainɥᥤȥۥ
mynetworks = 192.168.1.0/24, 127.0.0.0/8

postfixǡ᡼ܥåMaildirǶμήǡ᡼뤬1եˤʤäƤ
home_mailbox = Maildir/ 

POP3Ф
dovecotѤޤ

ʸõ
192.168.1.10Ȥʸ/etcǥ쥯ȥ椫õ硣

grep "192.168.1.10" /etc/*

ʸȾʸ̤-iץ
֥ǥ쥯ȥʲõϡ-rץrecersiveƵŪ

ե꡼Linux
CentOS

php󥹥ȡ
 
yumȤäapacheΥ⥸塼ɲä
# yum install php-mbstring
ApacheƵư
# /etc/init.d/httpd restart
PHPե /etc/php.iniꤹ롣ʥǥեȤǤ褤
phpե/var/www/html/aaa.php֤롣
http://192.168.1.100/aaa.phpˤƸ뤳ȤǤ롣

ԡ
cp-pǥʤɤݻޤޥԡ롣ppermanentȻפΥץĤʤȡȤȤΥȥԡΥѤǤ롣
cp-r(recursive)ǥ쥯ȥꤴȥԡ롣ʤߤmvˤ-rץ¸ߤʤ
()cp-rdirAdirBdirAdirBȤ̾ǥԡ

ư
mvȤ
ǥ쥯ȥǤȤ롣cpȰä-rץ
-fư˥ե뤬äƤ񤭤-fץĤ롣
-i񤭤˷ٹФ



rm-fʾäޤʹʤ
rm -rfȤȡե۲Υե뤴Ⱦä

LinuxǤRDPȤ
Linuxξϡrdesktophttp://www.rdesktop.org/ˤȤץȤС¤ϤΤΡWindows XP ProfessionalΥ⡼ȥǥȥå׵ǽ˥Ǥ롣
http://www.atmarkit.co.jp/flinux/rensai/linuxtips/431usexprd.html

ե
diff/etc/a.txt  /etc/b.txtȤ뤳Ȥǡa.txtb.txtΣĤΥեӤ뤳ȤǤ롣

locate
եξ򸡺Ǥ롣ʷ빽Ȥ

եʥǥ쥯ȥˤθ
㤨Сȥǥ쥯ȥ꤫顡pgsqlȤեǥ쥯ȥõ
find -name pgsql
ե򸡺ΤǤСcdǥ롼ȡ/ˤ˰ưɬפ롣
ե̾ˤϡȤ

ξ֤ǧ
/etc/sysconfig/i18n

LANGᡡꤵƤ줬狼

Ψʤɤ狼롣kϥХɽΰ̣dfϥե륷ƥñ̤Ǥɽǡduϥեǥ쥯ȥñ̤Ǥɽ
du-sssummuryǡͤФ桼Υۡǥ쥯ȥλ̹פ򸫤ʤɤǤ롣
df-hȤȡñ̤䤹ʤ롣
hhumanhȻפʹ֤䤹֤ˤʤ롣
ȤС4031396440G

롼ƥ
netstat -r롼ƥ󥰤˴ؤɽ
ƥå롼Ȥɲ
route add -net 10.1.1.0 netmask 255.255.255.0 gw 192.168.1.254 (eth0)
ǸΥ󥿡եeth0ʤ)Ͼάǽ


netstatޥ
-r 롼ƥ󥰥ơ֥ɽ
-a ٤Ƥ³ɽ
-l Listening³ɽ
-s Summeryסˤɽ롣ICMPʤɤΥץȥ뤴Ȥ˽󤵤롣

þ
init=initializeʽ
rc.dʤɤΤ褦ˡdĤƤΤϡǥ쥯ȥǤ뤳ȤŪ˼Ƥ롣

rcrun command

inittab=(initialize table)
/etc/inittabˤơǥեȤΥ٥ꤹ롣

ưץȤȼ¹ԥե
(1)ưץ
/etc/rc.d/init.d/sshd
ȤСstart ޥɤ錄줿ˤϤɤ뤹뤫
ܤƤ

(2)¹ԥե
/usr/sbin/sshd
ХʥեȤ¸ߤ롥

ޥɥ饤
|ѥסޥɤ³Ƽ¹
>쥯ȡ̤եؽ
;ޥɤ³Ƽ¹
&Хå饦ɤǼ¹
&&ޥɤη̤Yesʤ鼡Υޥɤ¹ԡդ||

LinuxˤPrintScreen

X window dumpȤޥɤϡƬʸȤäxwd

xwd -frame out ե̾

frameץϡե졼ޤƥץ㤹롣


crontab
0,71

-eԽ(edit)
-r remove
-l list

tcpdump
tcpdump src host 192.168.1.10 and port 80
192.168.1.1080ݡȤؤ̿򥭥ץ㤹롣

ڤؤ
Ctrl + Alt + F1F7ˤäơ󥽡̤ڤؤ뤳Ȥǽˤʤ롣ˤXwindowΤ褦ʥޥɥǽǤ롣

֥饦εư
firefox &ǥ֥饦ư
&ĤƤȡߥʥ³뤳ȤǤ

chmodѡߥåѹ
drwxr-xr-x
ǽ餬ǥ쥯ȥɽd
3ĤϽͭԤΥѡߥå
ΣĤϥ롼פΥѡߥå
Ǹ3ĤOtherʤ¾ˤΥѡߥå
-RץrecursiveʺƵŪˤΰ̣ǡǥ쥯ȥ۲Υեǥ쥯ȥ⤹٤ƥѡߥåѹ롣
ǥեȤΥѡߥåϡեξ礬666 - umaskǡǥ쥯ȥ777 - umaskĤޤꡢեξϼ¹Ը¤Ϳʤ㤨Сumask002Ǥä顢ե664Υˤʤ롣
umaskϤȡǥեȤumaskͤɽ롣
suidsgid
suidåȤȡ̥桼¹ԤƤroot¹ԤȤˤʤ롣

/etc/passwdեrootˤ¹Է郎̵̥桼ǤѥɤѹǤ롣ϡ/usr/bin/passwdsuidꤵƤ뤫顣/etc/passwdեǡ/usr/bin/passwdϼ¹ԥե롣
chmod u+s ե̾u+sΤȤ4755Τ褦Ƭ4ˤƤƱ
Τ褦ˡ+sĤ뤳ȤǡsuidǤ롣

TCPWrapper
/etc/hosts.allow/etc/hosts.denyեǥ򤹤롣
/etc/hosts.allowͥʤΤǡ/etc/hosts.allow˵Ĥ桼񤭡/etc/hosts.denyˤݤALL:ALLˡ

LinuxǤΥե
lokkitǴñǤ롣
ϡӥƵưɤä⡣

lokkitѤƤCentOS6Ǥϥޥɤۤʤ
$system-config-firewall

centosǤäƤʤfirewall-config

service iptables restart
ʣiptables
 
centos7äƤfirewalldϻȤʤʻȤ뤱ɥޥiptable 뤷ʤ

SELinux̵ˤ
/etc/sysconfig/selinuxեΡSELINUX=ġפȤʤäƤԤ
SELinux=disabledפȤ롣

SELinux ֤ǧˤ
$ getenforce
Enforcing ͭˤʤäƤ

ѹˤϡ/etc/selinux/config

disabled ̵
permissiveͭǤϤʤٹ𤬽Ф

Ƶưͭˤʤ롣ŪʤΤǤСsetenforce PermissiveȥޥɤǤƤФ

/etc/passwd桼󤬵

/etc/shadowѥɤΰŹ沽ե

/etc/group 롼׾󤬵ܤƤ롣롼ˡ桼޶ڤ󤵤롣
ѥɤ˴ؤƤϡ/etc/gshadow

桼(user1)ΥѥɤѤ
# passwd user1

su
su - ĤȴĶѿrootѤ롣ޤ-ĤʤƤ⤤͡
ͤޤǤˡsu -ĤȴĶѿѤΤǡʲΥޥɤǤĤȡUSER="root"ѤäƤ롣
# export

-̵ȤΤޤ

/boot֡ȴϢͥʤɤ
/etc  Ķե롡named.confʤ
/home桼Υۡǥ쥯ȥ
/tmpե롡
/binbinaryեʼ¹ԥեˤ
/sbinSuperUserμ¹ԥե뤬֤롣
/varlogʤɤ礭Ѳ(variable)ե
/dev
/usr

ͥåȥˡ
0) CLIGUIåꤹ롣
netconfigäϤʤʤꡢsystem-config-networkDzǽ

1)/etc/sysconfig/network
ƥΤΥͥåȥ򤹤롣
()  
NETWORKING=yesͥåȥͭ
HOSTNAME=localhostۥ̾
DOMAINNAME=domain.domɥᥤ̾
GATEWAY=192.168.0.1ǥեȥȥ

ǥեȥȥ/etc/sysconfig/network-scripts/ifcfg-ethX˽񤤤Ƥ褤NICʣ硢̷⤬ǽǤƤ롣ǥեȥȥ1ĤǤ٤ʤΤǡ˽񤯤٤Ǥ礦

2)/etc/hosts
WindowshostsեƱHost̾Ϥ˽񤭤ޤ礦/etc/sysconfig/networkȤΥեξ˵ܤƤ롣
192.168.1.1 ns1.domain.dom ns1 Ǹ ns1̵Ƥɤ

3)/etc/resolv.conf
͡ॵФ

searchdomain1.com
nameserver 192.168.1.1
nameserver 192.168.1.2
searchϥɥᥤ̾Ȥϥɥᥤ󥵥եåȹͤۤ褤searchξ硢DNSФϣĤޤǻǤ롣ɥᥤꤹdominǽ񤯡Ĥޤǡ

4)/etc/syconfig/network-scripts/ifcfg-eth1˽񤭹
Ǹeth1Ρ1פ󥿡եˤäѤ롣

DEVICE=eth1IF̾
BOOTPROTO=staticDHCPξdynamic
IPADDR=192.168.1.1
NETMASK=255.255.255.0

­ѹͥåȥͭˤˤ
ӥƵư롣
/etc/rc.d/init.d/networkrestart
ޤϡservice network restart

Centos7Ǥ
systemctl enable network
systemctl enable start

ͥåȥγǧ
1)ifconfiginterface configration)
ߤΥͥåȥξ֤ɽ롣
ifconfigˤIPɥ쥹ѹ뤳ȤǤ뤬ƵưȸäƤޤ

Centos7Ǥϡip a

2)nslookupdig
̾ΥƥȤԤ롣
ȤctrlD

3)ۥ̾ɽ
hostname

4)ɥᥤ̾ɽ
hostname -d
ddomainΰ̣

viǥȤ褦ˤ褦

G եκǸιԤذư
ֹ dzԤ˰ư롣1G ե1ܤ˰ư

wWrite¸ˤqQuitʽλˤǤ롣Ȥ߹碌ǽ
wq ¸ƽλZZǤ褤
q! ¸˽λ

ֹɽ롣
setnumber

ִ
[Ի]s/ʸ/ʸ/[g]

1)Ի
n:n
%եΤ٤Ƥι
$㤨С10,$s/ʸ/Ȥ顢10ܰʹߤִ

2)sִޥɡ
3)gԤʣȤִ롣ꤷʤС1ܤʸΤִ롣cȤȤǡŪִǽ

<>
:%s/test/Test/g


ޥκƱ˥åȡԡڡȤǤ

GUIΥǥ
centos6ȤȡgeditȻפ

#ntpq -p
"*"ɽƱȤƤ롣ˤϤȤʤ
service ntpd startǥӥϵưȻפ

饤¦
ʲΥޥɤѤƱȤ롣
#/usr/sbin/ntpdate -bs 192.168.1.1
-bsϥץʤΤǤʤƤɤ
饤Ȥntpdư̤NTPФ򻲾Ȥ褦ˤƤ⤤NTPФʣưƤΤ⤪פϡNTP饤ȤȤưʤΤˡ虜虜NTPФưɬפϤʤCRON֤ƱФ褤

濫碌
# date --set="2003/10/8 16:20"
ޤϡ
date 100816202003

NTPФƱ򤹤ˤ㤨аʲgoogleǤ
ntpdate time.google.com

ݥ󥵡ɥ

ΥڡΥȥåץ