Skip to main content

Linux Notes

Linux Notes

SSH Sign-in with Certificate

Do this once.
ssh-keygen -t rsa -b 4096 -C “your_email@domain.com”

Send cert to server.
ssh-copy-id remote_username@server_ip_address

journalctl -xe

sudo nano /etc/ssh/sshd_config
PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM no
sudo systemctl restart ssh

SSH Login Banner Sample
Welcome to QUANTUM.isinj.com All connections are monitored and recorded Disconnect IMMEDIATELY if you are not an authorized user!

Set Timezone

Ubuntu Date:
ntpdate -s ntp.ubuntu.com
dpkg-reconfigure tzdata

Jitsi Config

To remove Jitsi logo
/usr/share/jitsi-meet/interface_config.jså
SHOW_WATERMARK_FOR_GUESTS: false;
SHOW_JITSI_WATERMARK: false,

Restart Jitsi
/etc/init.d/jitsi-videobridge2 restart

sudo systemctl restart nginx

MySQL Database

sudo mysql -u root -p
show databases;
use DBNAME;

CREATE DATABASE moodle;
USE moodle;

CREATE USER ‘non-root’@’localhost’ IDENTIFIED BY ‘password’;
GRANT ALL PRIVILEGES ON . TO ‘username’@’localhost’ IDENTIFIED BY ‘password’;
GRANT ALL PRIVILEGES ON learn TO ‘moodle’@’localhost’;
FLUSH PRIVILEGES;

mysql> GRANT ALL PRIVILEGES ON database_name.* TO ‘username’@’localhost’;

Backup / Restore

mysql -u username -p dbname < dbexport.sql
mysqldump -u username -p dbname > dbexport.sql

User Management

DROP USER ‘non-root’@‘localhost’;
mysqladmin –user=root password “newpassword”

MySQL Installation

sudo apt-get update
sudo apt-get install mysql-server
sudo mysql_secure_installation utility
sudo ufw enable
sudo ufw allow mysql
sudo systemctl start mysql
sudo systemctl enable mysql

MySQL Remote Access

Configure Interfaces
/etc/mysql/mysql.conf.d/mysqld.cnf

bind-address = 127.0.0.1 ( The default. )
bind-address = XXX.XXX.XXX.XXX ( The ip address of your Public Net interface. )
bind-address = 0.0.0.0 ( All ip addresses. )

Replace Domain/Hostname in .sql

sed -e ‘s/oldserver.com/newserver.com/g’ oldmysqldump.sql > newmysqldump.sql
yourserver.com/admin/tool/replace/index.php