apt install powershell apt install -y unixodbc unixodbc-dev odbc-postgresql
修正 /etc/odbcinst.ini
(沒修正執行的時候可能會出現找不到 psqlodbcw.so 八拉巴拉的錯誤訊息)
Driver=/usr/lib/x86_64-linux-gnu/odbc/psqlodbca.so
建立一個附檔名為 xxx.ps1 的檔案然後內容大致如下。
#!/usr/bin/pwsh
$MyServer = "主機IP"
$MyPort = "資料庫連接Port"
$MyDB = "資料庫名稱"
$MyUid = "使用帳號"
$MyPass = "使用密碼"
#Write-Output "Processing file: 系統測試"
$DBConnectionString = "DRIVER={PostgreSQL Unicode};Server=$MyServer;Port=$MyPort;Database=$MyDB;Uid=$MyUid;Pwd=$MyPass;"
$DBConn = New-Object System.Data.Odbc.OdbcConnection;
$DBConn.ConnectionString = $DBConnectionString;
$DBConn.Open();
$DBCmd = $DBConn.CreateCommand();
$DBCmd.CommandText = @"
select
e.name , u.full_name , u.organization , u.email_address
from public.guacamole_user u
"@
$reader=$DBCmd.ExecuteReader();
while ($reader.Read()) {
# 處理每一行數據
$name = $reader["name"]
$full_name = $reader["full_name"]
$name = $reader["organization"]
$email_address = $reader["email_address"]
echo "$name`t$full_name`t$name$email_address"
}
$DBConn.Close();
安裝必要套件 sudo apt install libpam-google-authenticator 編輯 /etc/ssh/sshd_config 調整 KbdInteractiveAuthentication , ChallengeResponseAuthentication 設定 略.. # Change to yes to enable challenge-response passwords (beware issues with # some PAM modules and threads) KbdInteractiveAuthentication yes ChallengeResponseAuthentication yes
Mar 20, 2025LogServer跑 ubuntu server , 預計佈署 rsyslog server 收計 AP 送來的Log資料。
Mar 6, 2025在實務應用上<
Feb 11, 2025Ubuntu 24.04 的版本預設的套件來源就有docker相關軟體,所以安裝就相對簡單。apt install docker-compose-v2 一行指就可以完成安裝了。
Jan 20, 2025or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up