You Can If You Think You Can >
Mr.Jodoi say

" โจดอยทำได้คุณก็ต้องทำได้ "

นายเกรียงศักดิ์ นามโคตร (อาจารย์ดอย)

ผู้ก่อตั้ง บริษัทโจดอย ไอทีแอนด์เซอร์วิส จำกัด ปัจจุบันดำรงตำแหน่งกรรมการผู้จัดการบริษัทโจดอย ไอทีแอนด์เซอร์วิส จำกัดและเป็นวิทยากรบรรยายพิเศษให้กับหน่วยงานทั้งภาครัฐและเอกชน

Certifications :
- CCNA (Cisco Certify Nework Associate)
- CCNA Security (Cisco Certified Network Associate Security)
- CCDA (Cisco Certified Design Associate)
- Cisco Express Foundation Design Specialist
- CCNP (Cisco Certified Network Professional)
- CCDP (Cisco Certified Design Professional)
- SBCSEN , SBCSAM , SMBAM , SMBEN , CQS-SMBE from Cisco SMB University
- CompTIA Linux+
- CompTIA Security+
- Pearson VUE Certified Administrator

More

--------------------------------------------------------------------

Basic Network Command by Mr.Jodoi

มาเรียนรู้การใช้ Network Command เบื้องต้นกันนะครับ ขอแนะนำ command ping และ command traceroute จากวีดีโอที่อาจารย์เกรียงศักดิ์ นามโคตร (อาจารย์ดอย) ทำไว้ใน youtube ครับ


IP Address version 4 ตอนที่ 1 by Jodoi

มาเรียนรู้การคำนวณ IP Address version 4 ด้วยเทคนิคการใช้ตารางมหัศจรรย์ซึ่งทำให้ศิษย์นำไปใช้ในการทำงานและการสอบ Cert.IT ได้อย่างดีเยี่ยม

Basic Linux Command ตอนที่ 1 (ls,cat,vi)by Jodoi

มาเรียนรู้การใช้ Linux Command เบื้องต้นกันครับ เริ่มต้นด้วย command ls , cat และ vi ซึ่งปัจจุบันมีความจำเป็นต้องเรียนรู่อย่างยิ่งเพราะหลายๆองค์กรมีการใช้ Linux Server กันมากขึ้น

 

และยังมีวีดีโอดีๆอีกมากมายรับชมได้ใน แชลแนล Mr.Jodoi ตามด้านล่างนะครับ

https://www.youtube.com/user/MrJodoi

 




Root Privileges to a User by Jodoi

สำหรับผู้ทีใช้งาน Linux Server อยู่ ที่มีความต้องการให้ Username ธรรมดามีสิทธิเท่ากับ Root ( User root คือ Admin ใน Linux Server )

เริ่มด้วยการตรวจสอบว่าปัจจุบันเรา login ด้วย Username อะไรอยู่ ด้วย command whoami

[root@jodoi-server ~]# whoami
root

หรือ

[user1@jodoi-server ~]$ whoami
user1

 

เราสามารถตรวจสอบ Username ใน Linux Server ได้ด้วย command cat /etc/passwd

[user1@jodoi-server ~]$ cat /etc/passwd

jodoi:x:1001:1001::/home/jodoi:/bin/bash
user1:x:1002:1002::/home/user1:/bin/bash
user2:x:1003:1003::/home/user2:/bin/bash
user3:x:1005:1005::/home/user3:/bin/bash
user4:x:1006:1006::/home/user4:/bin/bash
jodoi2:x:1007:1007::/home/jodoi2:/bin/bash
jodoi3:x:1008:1008::/home/jodoi3:/bin/bash
jodoi1:x:1009:1009::/home/jodoi1:/bin/bash

jodoi4:x:1010:1010::/home/jodoi4:/bin/bash

เราสามารถเปลี่ยน Username ได้ด้วย command su - ตามด้านล่าง ถ้าตามด้วย Username ใดคือเปลี่ยนเป็น Username นั้น แต่ถ้าไม่ใส่ Username คือการ เปลี่ยนเป็น root ครับ ( การใส่ - คือการให้สิทธิเท่ากับเจ้าของ Username )

[user1@jodoi-server ~]$ su - user2
Password:
Last login: Wed Jul 26 10:43:58 +07 2023 from 192.168.2.200 on pts/3
[user2@jodoi-server ~]$

[user2@jodoi-server ~]$ su -
Password:
Last login: Wed Aug 2 10:40:52 +07 2023 on pts/0
[root@jodoi-server ~]#


โดยปกติแล้ว Username ธรรมดาจะไม่สามารถทำการ Start หรือ Stop Service ต่างๆได้ ต้องใช้ command sudo ช่วยในการ Start หรือ Stop Service

[user2@jodoi-server ~]$ sudo service network restart

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for user2:
user2 is not in the sudoers file. This incident will be reported.
[user2@jodoi-server ~]$ sudo service httpd restart
[sudo] password for user2:
user2 is not in the sudoers file. This incident will be reported.
[user2@jodoi-server ~]$


แต่ถ้าเป็น Username root จะสามารถทำได้

[user2@jodoi-server ~]$ su -
Password:
Last login: Wed Aug 2 11:32:57 +07 2023 on pts/0
[root@jodoi-server ~]#
[root@jodoi-server ~]#
[root@jodoi-server ~]# service network restart
Restarting network (via systemctl): [ OK ]
[root@jodoi-server ~]#

เราสามารถแต่งตั้งให้ Username ธรรมดามีสิทธิเทียบเท่า root ได้โดยการเพิ่ม Username ใน file /etc/sudoers หรือ ด้วย command visudo ดังนี้

[root@jodoi-server ~]# vi /etc/sudoers

หรือ
[root@jodoi-server ~]# visudo

## Allow root to run any commands anywhere
root ALL=(ALL) ALL
jodoi ALL=(ALL) ALL
user2 ALL=(ALL) ALL

:wq!

[root@jodoi-server ~]#

ทดสอบ restart service ใหม่จะสามารถดำเนินการได้แล้วครับ โดยที่ใช้ Password ของ Username นั้นๆได้เลย ไม่ต้องใช้ Password ของ root ครับ

[user2@jodoi-server ~]$ sudo service network restart
[sudo] password for user2:
Restarting network (via systemctl): [ OK ]
[user2@jodoi-server ~]$
[user2@jodoi-server ~]$

 

วีดีโอแนะนำเรียนรู้วิธีการ Add User ใน Linux โดย Mr.Jodoi - Basic Linux Command

 

วีดีโอแนะนำ วิธีการทำให้ Linux Server มีความปลอดภัยมากขึ้น - Linux Security โดย Mr.Jodoi

 

 

หวังว่าบทความนี้ คงจะเป็นประโยชน์ไม่มากก็น้อยนะครับ

เรียบเรียงโดย อาจารย์เกรียงศักดิ์ นามโคตร ( อาจารย์ดอย ) Mr.Jodoi

--------------------------------------------------------------------------------------------------------

บทความ Network

บทความ Linux

บทความ Certificate