14 August 2024

Router'dan PPPoE Bilgileri Öğrenme

 Öncelikle, router'dan bağlantı yapılacak bir PC gerekli.

32 bit işlemcili ise ubuntu-16.04.6-server-i386.iso,

64 bir işlemcili ise herhangi bir ubuntu server sürümü indirilip, rufus ile USB'ye yazdırılır ve kurulum yapılır.



Sonra sırasıyla;

"apt install pppoe"

komutu girilir.

Aşağıdaki dosya yeniden düzenlenir;

 

# /etc/ppp/options

require-pap
login

# LCP settings
lcp-echo-interval 10
lcp-echo-failure 2

# Always Show Password
show-password

# Debug enable
debug

# PPPoE compliant settings
noaccomp
default-asyncmap
mtu 1492

# Log All
logfile /var/log/pppoe-server.log

# ---<End of File>--- 

 

"ifconfig -a" ile kullanılan adaptorun adı alınır.

"screen" ile bir background penceresi açılıp;

"pppoe-server -F -I ens3 -O /etc/ppp/options" komutu girilip, screen'den çıkılır.

Router ile PC ethernet bağlantısı kurularak, router açılır.


"cat /var/log/pppoe-server.log" komutu ile log kontrol edilir.

Kullanıcı adı ve şifresi logda görünecektir.

Log dosyası oluşmuyorsa, manuel olarak oluşturulabilir.



 

 

07 August 2024

Access Windows File System From Ubuntu Server ( 20.04, 22.04, 24.04 )

sudo apt-get update
sudo apt-get install cifs-utils


sudo mkdir /mnt/windows2012-share


sudo mount -t cifs "//192.168.10.212/C$/Users/Administrator/Desktop/Bilgi Aktar TFT" /mnt/windows2012-share -o username=administrator,password='Lxxxxxxxxxxx!',iocharset=utf8,file_mode=0777,dir_mode=0777



sudo nano /etc/fstab

 add line below:

//192.168.10.212/C$/Users/Administrator/Desktop/Bilgi\040Aktar\040TFT /mnt/windows2012-share cifs username=administrator,password='Lxxxxxxxxxxx!',iocharset=utf8,file_mode=0777,dir_mode=0777 0 0



And then:
write a file read script and do the jobs.

Backup Multiple MySQL Tables Into One Single Compressed File

 #!/bin/bash

# Set variables
DB_NAME="usakbasari"
OUTPUT_FILE="/var/www/citizen_tables_backup.sql.gz"
TABLES_FILE="/tmp/citizen_tables.txt"

# Prompt for MySQL password
echo -n "Enter MySQL root password: "
read -s MYSQL_PASSWORD
echo

# Fetch the list of tables
mysql -u root -p$MYSQL_PASSWORD -N -e "SELECT TABLE_NAME FROM information_schema.tables WHERE table_schema = '$DB_NAME' AND TABLE_NAME LIKE 'citizen_%'" > $TABLES_FILE

# Create or clear the output file
> $OUTPUT_FILE

# Read the table names and back up in chunks
while read -r TABLE; do
    echo "Backing up $TABLE..."
    mysqldump -u root -p$MYSQL_PASSWORD $DB_NAME $TABLE | gzip >> $OUTPUT_FILE
done < $TABLES_FILE

echo "Backup complete: $OUTPUT_FILE"