Chi tiết cấu hình môi trường:
Hệ điều hành: Redhat Enterprise Linux 8.4 64 bit
Giả sử tôi có thiết lập Oracle RAC ba nút và muốn cấu hình xác thực SSH cho người dùng oracle , grid hoặc bất kỳ người dùng nào khác, hãy làm theo các bước dưới đây để thực hiện điều đó.
Đăng nhập với tư cách người dùng oracle và thực hiện các lệnh bên dưới. Nếu bạn muốn cấu hình cho người dùng grid, hãy đăng nhập với tư cách người dùng grid.
Bước 1: Xóa thư mục "/home/oracle/.ssh" hiện có trên tất cả các máy chủ và tạo lại thư mục đó.
[oracle@ rac1 ~]$ rm -rf .ssh
[oracle@ rac2 ~]$ rm -rf .ssh
[oracle@ rac3 ~]$ rm -rf .ssh
[oracle@ rac1 ~]$ mkdir .ssh
[oracle@ rac2 ~]$ mkdir .ssh
[oracle@ rac3 ~]$ mkdir .ssh
[oracle@ rac1 ~]$ chmod 700 .ssh
[oracle@ rac2 ~]$ chmod 700 .ssh
[oracle@ rac3 ~]$ chmod 700 .ssh
Bước 2: Truy cập vào thư mục "/home/oracle/.ssh" và tạo khóa rsa và dsa trên tất cả các node.
[oracle@ rac1 ~]$ cd /home/oracle/.ssh
[oracle@ rac2 ~]$ cd /home/oracle/.ssh
[oracle@ rac3 ~]$ cd /home/oracle/.ssh
Trên Node1:
[oracle@rac1 .ssh]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:1PiMgzmPvLA26N/f6u7kxkJ9bFbOn/Cj4D2IKXDj7mE oracle@rac1.localdomain
The key's randomart image is:
+---[RSA 3072]----+
| |
| o |
| o . |
| + + . |
| +.S.o+ |
| ..++..= + |
| ..=Eoo*.. + . |
| . o=+==o.o. = |
| ..oo+=OB.o oo . |
+----[SHA256]-----+
[oracle@rac1 .ssh]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_dsa.
Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
SHA256:aQSj/tG2GK+QDrTGBVsh8BqNNIVI9g39LjATrRahuE8 oracle@rac1.localdomain
The key's randomart image is:
+---[DSA 1024]----+
|+*++= o |
|==++o= o |
|+.+.*.. . |
| + @ + . |
|o E * + S |
| = o + O . |
| * o + o |
| . o . . |
| . . |
+----[SHA256]-----+
Trên Node2:
[oracle@rac2 .ssh]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:q4jILUpzCHgRViUHEVz+S83PJlmo7YWmWp2TYyzCPFo oracle@rac2.localdomain
The key's randomart image is:
+---[RSA 3072]----+
| oo**+ |
| . ..+ |
| . . |
|. . . o . |
|o . S + . |
|... o . B O |
| + . E * # = |
|oo+. + = * * |
|+.o.o o.. . |
+----[SHA256]-----+
[oracle@rac2 .ssh]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_dsa.
Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
SHA256:FwQAcyGPufeF53/G7mCUXiKbGZR4eaDcj6PHup+l15Q oracle@rac2.localdomain
The key's randomart image is:
+---[DSA 1024]----+
| +.+o..o |
| B . = + |
| o . + B . |
| . + = . |
| . . S O = .. |
| . . B X oE |
| o B =+ |
| o *..= |
| oo+..=o |
+----[SHA256]-----+
Trên Node3:
[oracle@rac3 .ssh]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa): Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:/+XUZ0/QQnRmeqBPBEq+VFXQ8HYsibdI5fN7vfCo6NI oracle@rac3.localdomain
The key's randomart image is:
+---[RSA 3072]----+
| . ooO==|
| o o B X.|
| + + X *|
| . o * O.|
| S . . = o|
| . +o|
| . . .o.B|
| . E.. ++o=|
| oo .o..o.|
+----[SHA256]-----+
[oracle@rac3 .ssh]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_dsa.
Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
SHA256:BoK8Y7WSOkfo2bMQzZeG4ZguHzT9waUtznedOMuDJbc oracle@rac3.localdomain
The key's randomart image is:
+---[DSA 1024]----+
| |
| . . |
| o.o . . |
| .*=o+.= |
|.+X=o+= S |
|o=++o+ +. oo . |
|+=oo + .=+.o |
|.+..o ..oEo |
| .. o. |
+----[SHA256]-----+
Bước 3: Chuyển hướng tất cả dữ liệu tệp *.pub đến Node tương ứng với tên máy chủ được ủy quyền (authorized_keys.hostname).
[oracle@ rac1 .ssh]$ cat *.pub >> authorized_keys. rac1
[oracle@ rac2 .ssh]$ cat *.pub >> authorized_keys. rac2
[oracle@ rac3 .ssh]$ cat *.pub >> authorized_keys. rac3
Sao chép các tệp trên sang các nút khác, tức là sao chép tệp của nút đầu tiên sang nút 2 và nút 3, tệp của nút thứ hai sang nút 1 và nút 3, và tệp của nút thứ ba sang nút 1 và nút 2.
[oracle@ rac1 .ssh]$ scp authorized_keys. rac1 oracle@ rac2 :/home/oracle/.ssh/
[oracle@ rac1 .ssh]$ scp authorized_keys. rac1 oracle@ rac3 :/home/oracle/.ssh/
[oracle@ rac2 .ssh]$ scp authorized_keys. rac2 oracle@ rac1 :/home/oracle/.ssh/
[oracle@ rac2 .ssh]$ scp authorized_keys. rac2 oracle@ rac3 :/home/oracle/.ssh/
[oracle@ rac3 .ssh]$ scp authorized_keys. rac3 oracle@ rac1 :/home/oracle/.ssh/
[oracle@ rac3 .ssh]$ scp authorized_keys. rac3 oracle@ rac2 :/home/oracle/.ssh/
Bước 4: Chuyển hướng tất cả dữ liệu tệp *.rac đến Node tương ứng như sau:
các khóa được ủy quyền
[oracle@rac1 .ssh]$ cat *.rac* >> authorized_keys
[oracle@rac2 .ssh]$ cat *.rac* >> authorized_keys
[oracle@rac3 .ssh]$ cat *.rac* >> authorized_keys
[oracle@rac1 .ssh]$ chmod 600 authorized_keys
[oracle@rac2 .ssh]$ chmod 600 authorized_keys
[oracle@rac3 .ssh]$ chmod 600 authorized_keys
[oracle@rac1 .ssh]$ ll
-rw------- 1 oracle oinstall 3570 Jan 13 16:43 authorized_keys
-rw-r--r-- 1 oracle oinstall 1190 Jan 13 16:41 authorized_keys.rac1
-rw-r--r-- 1 oracle oinstall 1190 Jan 13 16:42 authorized_keys.rac2
-rw-r--r-- 1 oracle oinstall 1190 Jan 13 16:42 authorized_keys.rac3
-rw------- 1 oracle oinstall 1393 Jan 13 16:41 id_dsa
-rw-r--r-- 1 oracle oinstall 613 Jan 13 16:41 id_dsa.pub
-rw------- 1 oracle oinstall 2610 Jan 13 16:40 id_rsa
-rw-r--r-- 1 oracle oinstall 577 Jan 13 16:40 id_rsa.pub
-rw-r--r-- 1 oracle oinstall 358 Jan 13 16:42 known_hosts
[oracle@rac2 .ssh]$ ll
-rw------- 1 oracle oinstall 3570 Jan 13 16:43 authorized_keys
-rw-r--r-- 1 oracle oinstall 1190 Jan 13 16:41 authorized_keys.rac1
-rw-r--r-- 1 oracle oinstall 1190 Jan 13 16:41 authorized_keys.rac2
-rw-r--r-- 1 oracle oinstall 1190 Jan 13 16:42 authorized_keys.rac3
-rw------- 1 oracle oinstall 1393 Jan 13 16:41 id_dsa
-rw-r--r-- 1 oracle oinstall 613 Jan 13 16:41 id_dsa.pub
-rw------- 1 oracle oinstall 2610 Jan 13 16:41 id_rsa
-rw-r--r-- 1 oracle oinstall 577 Jan 13 16:41 id_rsa.pub
-rw-r--r-- 1 oracle oinstall 358 Jan 13 16:42 known_hosts
[oracle@rac3 .ssh]$ ll
-rw------- 1 oracle oinstall 3570 Jan 13 16:43 authorized_keys
-rw-r--r-- 1 oracle oinstall 1190 Jan 13 16:42 authorized_keys.rac1
-rw-r--r-- 1 oracle oinstall 1190 Jan 13 16:42 authorized_keys.rac2
-rw-r--r-- 1 oracle oinstall 1190 Jan 13 16:41 authorized_keys.rac3
-rw------- 1 oracle oinstall 1393 Jan 13 16:41 id_dsa
-rw-r--r-- 1 oracle oinstall 613 Jan 13 16:41 id_dsa.pub
-rw------- 1 oracle oinstall 2610 Jan 13 16:41 id_rsa
-rw-r--r-- 1 oracle oinstall 577 Jan 13 16:41 id_rsa.pub
-rw-r--r-- 1 oracle oinstall 358 Jan 13 16:42 known_hosts
Bước 5: Bây giờ chúng ta có thể kiểm tra xác thực SSH bằng các lệnh dưới đây. Hãy đảm bảo rằng xác thực tự thân cũng được yêu cầu, tức là Node1-Node1, Node2-Node2, Node3-Node3, nếu không chúng ta không thể tiếp tục cài đặt.
[oracle@rac1 .ssh]$ ssh rac1
[oracle@rac1 .ssh]$ ssh rac2
[oracle@rac1 .ssh]$ ssh rac3
[oracle@rac2 .ssh]$ ssh rac2
[oracle@rac2 .ssh]$ ssh rac1
[oracle@rac2 .ssh]$ ssh rac3
[oracle@rac3 .ssh]$ ssh rac3
[oracle@rac3 .ssh]$ ssh rac1
[oracle@rac3 .ssh]$ ssh rac2
[oracle@rac1 .ssh]$ ssh rac1
The authenticity of host 'rac1 (10.20.30.101)' can't be established.
ECDSA key fingerprint is SHA256:paSUsPHPoUwF04C4TJffskwngg82TS389hoEYRvbWJ4.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'rac1,10.20.30.101' (ECDSA) to the list of known hosts.
Activate the web console with: systemctl enable --now cockpit.socket
This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register
Last login: Thu Dec 29 02:59:55 2022
[oracle@rac1 ~]$ ssh rac2
Activate the web console with: systemctl enable --now cockpit.socket
This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register
Last login: Fri Jan 13 16:44:53 2023 from 10.20.30.101
[oracle@rac2 ~]$ ssh rac2
The authenticity of host 'rac2 (10.20.30.102)' can't be established.
ECDSA key fingerprint is SHA256:paSUsPHPoUwF04C4TJffskwngg82TS389hoEYRvbWJ4.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'rac2,10.20.30.102' (ECDSA) to the list of known hosts.
Activate the web console with: systemctl enable --now cockpit.socket
This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register
Last login: Fri Jan 13 16:45:08 2023 from 10.20.30.101
[oracle@rac2 ~]$ ssh rac3
Activate the web console with: systemctl enable --now cockpit.socket
This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register
Last login: Thu Dec 29 03:00:30 2022
[oracle@rac3 ~]$ ssh rac3
The authenticity of host 'rac3 (10.20.30.106)' can't be established.
ECDSA key fingerprint is SHA256:paSUsPHPoUwF04C4TJffskwngg82TS389hoEYRvbWJ4.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'rac3,10.20.30.106' (ECDSA) to the list of known hosts.
Activate the web console with: systemctl enable --now cockpit.socket
This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register
Last login: Fri Jan 13 16:45:15 2023 from 10.20.30.102
[oracle@rac3 ~]$ ssh rac1
Activate the web console with: systemctl enable --now cockpit.socket
This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register
Last login: Fri Jan 13 16:45:02 2023 from 10.20.30.101
Bạn đã cấu hình thành công xác thực SSH hoặc cấu hình không cần mật khẩu.
TƯ VẤN: Click hoặc Hotline/Zalo 090.29.12.888
=============================
Website không chứa bất kỳ quảng cáo nào, mọi đóng góp để duy trì phát triển cho website (donation) xin vui lòng gửi về STK 90.2142.8888 - Ngân hàng Vietcombank Thăng Long - TRAN VAN BINH
=============================
Nếu bạn không muốn bị AI thay thế và tiết kiệm 3-5 NĂM trên con đường trở thành DBA chuyên nghiệp hay làm chủ Database thì hãy đăng ký ngay KHOÁ HỌC ORACLE DATABASE A-Z ENTERPRISE, được Coaching trực tiếp từ tôi với toàn bộ bí kíp thực chiến, thủ tục, quy trình của gần 20 năm kinh nghiệm (mà bạn sẽ KHÔNG THỂ tìm kiếm trên Internet/Google) từ đó giúp bạn dễ dàng quản trị mọi hệ thống Core tại Việt Nam và trên thế giới, đỗ OCP.
- CÁCH ĐĂNG KÝ: Gõ (.) hoặc để lại số điện thoại hoặc inbox https://m.me/tranvanbinh.vn hoặc Hotline/Zalo 090.29.12.888
- Chi tiết tham khảo:
https://bit.ly/oaz_w
=============================
2 khóa học online qua video giúp bạn nhanh chóng có những kiến thức nền tảng về Linux, Oracle, học mọi nơi, chỉ cần có Internet/4G:
- Oracle cơ bản: https://bit.ly/admin_1200
- Linux: https://bit.ly/linux_1200
=============================
KẾT NỐI VỚI CHUYÊN GIA TRẦN VĂN BÌNH:
📧 Mail: binhoracle@gmail.com
☎️ Mobile/Zalo: 0902912888
👨 Facebook: https://www.facebook.com/BinhOracleMaster
👨 Inbox Messenger: https://m.me/101036604657441 (profile)
👨 Fanpage: https://www.facebook.com/tranvanbinh.vn
👨 Inbox Fanpage: https://m.me/tranvanbinh.vn
👨👩 Group FB: https://www.facebook.com/groups/DBAVietNam
👨 Website: https://www.tranvanbinh.vn
👨 Blogger: https://tranvanbinhmaster.blogspot.com
🎬 Youtube: https://www.youtube.com/@binhguru
👨 Tiktok: https://www.tiktok.com/@binhguru
👨 Linkin: https://www.linkedin.com/in/binhoracle
👨 Twitter: https://twitter.com/binhguru
👨 Podcast: https://www.podbean.com/pu/pbblog-eskre-5f82d6
👨 Địa chỉ: Tòa nhà Sun Square - 21 Lê Đức Thọ - Phường Mỹ Đình 1 - Quận Nam Từ Liêm - TP.Hà Nội
=============================
cơ sở dữ liệu, cơ sở dữ liệu quốc gia, database, AI, trí tuệ nhân tạo, artificial intelligence, machine learning, deep learning, LLM, ChatGPT, DeepSeek, Grok, oracle tutorial, học oracle database, Tự học Oracle, Tài liệu Oracle 12c tiếng Việt, Hướng dẫn sử dụng Oracle Database, Oracle SQL cơ bản, Oracle SQL là gì, Khóa học Oracle Hà Nội, Học chứng chỉ Oracle ở đầu, Khóa học Oracle online,sql tutorial, khóa học pl/sql tutorial, học dba, học dba ở việt nam, khóa học dba, khóa học dba sql, tài liệu học dba oracle, Khóa học Oracle online, học oracle sql, học oracle ở đâu tphcm, học oracle bắt đầu từ đâu, học oracle ở hà nội, oracle database tutorial, oracle database 12c, oracle database là gì, oracle database 11g, oracle download, oracle database 19c/21c/23c/23ai, oracle dba tutorial, oracle tunning, sql tunning , oracle 12c, oracle multitenant, Container Databases (CDB), Pluggable Databases (PDB), oracle cloud, oracle security, oracle fga, audit_trail,oracle RAC, ASM, oracle dataguard, oracle goldengate, mview, oracle exadata, oracle oca, oracle ocp, oracle ocm , oracle weblogic, postgresql tutorial, mysql tutorial, mariadb tutorial, ms sql server tutorial, nosql, mongodb tutorial, oci, cloud, middleware tutorial, docker, k8s, micro service, hoc solaris tutorial, hoc linux tutorial, hoc aix tutorial, unix tutorial, securecrt, xshell, mobaxterm, putty