Skip to main content

Posts

Showing posts from August, 2019

[Linux][SSH] Sự khác nhau giữa authorized_keys và known_hosts file trong thư mục ~/.ssh

2 file này xuất hiện khi máy ubuntu của bạn vừa là server vừa là client known_hosts Khi máy của bạn là client, known_hosts sẽ lưu lại public key của những server(host) bạn đã truy cập trước đó. authorized_keys Khi máy của bạn là server, authorized_keys lưu lại public key của những client đã kết nối đến máy của bạn trước đó. Các câu hỏi khác liên quan: 1. Làm thế nào để cấu hình ssh server? 2. Làm thế nào để share public key từ client cho server? 3. Có mấy kiểu giải mã, mã hóa dữ liệu khi sử dụng ssh? 4. Làm thế nào để tạo ra cặp mã hóa private and public? 5. Cơ chế sử dụng key? References: https://security.stackexchange.com/questions/20706/what-is-the-difference-between-authorized-keys-and-known-hosts-file-for-ssh

[Linux] miscellaneous

Create directory tree in linux using C plusplus https://www.tutorialspoint.com/how-can-i-create-directory-tree-using-cplusplus-in-linux Example is not correct at all when it handle "status" it should be: #include < bits / stdc ++. h > #include <iostream> #include <sys/stat.h> #include <sys/types.h> using namespace std ; int main () {     int status ;    status = system ( "mkdir -p TP/My_Folder/test" ); // Creating a directory     if ( status ! = 0 )       std::cerr << "Error : " << strerror ( errno ) << std::endl ;     else       std::cout << "Directories are created" << std::endl ; } What is default permission of command  " system ( "mkdir -p TP/My_Folder/test" ); "? The answer is 755 or drwxr-xr-x What is drwxr-xr-x? It looks like 4 groups:  d  rwx  r-x  r-x d: directory (file is "-") rwx: owner can read/write/