This is a linux documents using debian 10
View it on HACKMD: https://hackmd.io/@wilicw/linuxSkills
Linux Distribution : Debian 10
Change timezone
Show timezone
Change hostname
sudo useradd -m -d "/home/username" -s /bin/bash username
Edit /home/user/.bash_logout
Edit /etc/gdm3/daemon.conf
Edit /etc/pam.d/gdm-password
Edit /etc/profile
main file: /etc/network/interfaces
Change interface name to old syntax (ens33 -> eth0)
Add net.ifnames=0 biosdevname=0
into GRUB_CMDLINE_LINUX
Update grub
force to clean ip of interface
renew a dhcp ip
Edit /etc/resolv.conf
Add bond0 in /etc/network/interfaces
Allow some users use crontab
Edit /etc/cron.allow
Deny some users use crontab
Edit /etc/cron.deny
Level: Allow > Deny
Edit User's crontab
or Edit System's crontb in /etc/crontab
as root
Format
Example
Edit /etc/fstab
Remount
Create aquota.user
and aquota.group
file
Load config
Setting up User disk limit
Create a shell script in any folder
Create and edit /etc/systemd/system/service-name.service
Enable the service
Edit ~/.bashrc
Edit ~/.bashrc
Install nginx
Start nginx in startup
Using htpasswd
command
Create password file in /var/www/.passwd
via htpasswd
Adding more user in passwd file
Configuring nginx
config file in /etc/ssh/sshd_config
Edit /etc/fail2ban/jail.local
Generating RSA Key pair in client pc
Copy rsa id to server
Edit Server side config
Enable ip forward setting
Forward enable at evey boot
Edit /etc/sysctl.conf
If want to allow PPTP passthrough. Run modprobe ip_nat_pptp
See NFTables
Add interface name in /etc/default/isc-dhcp-server
Edit /etc/dhcp/dhcpd.conf
Restart dhcp server
Show dhcp client
Edit /etc/default/dhcp-helper
Forward all dhcp requests traffic to 192.168.10.2
Zone: skills39.co
Edit /etc/bind/named.conf.loacl
And edit /etc/bind/skills39.co.db
Restart DNS server
Test DNS server
Output
iptables is replace by nftables
more at #nftables
Clean up the old setting
NAT configuration via iptables
Edit /etc/sysctl.conf
IN interface: ens33
forward 8080 port to 192.168.1.20:80
Configration file at /etc/nftables.conf
Edit config file
Edit /etc/nftables.conf
Forward eth0
80 port to 192.168.1.2:80
Edit /etc/samba/smb.conf
Add samba user
Add /etc/vsftpd.conf
Add /etc/vsftpd.conf
Create /etc/vsftpd.userlist
Only User1
User2
User3
can access ftp server
Create /var/ftp
and allow all user read
Edit /etc/vsftpd.conf
Edit /etc/vsftpd.userlist
Banner
Restart vsftpd service
Edit /etc/ntp.conf
Restart ntp server
-name
file name you want to find
-regex
use Regex to find with name
-exec
trigger a command when target meet the criteria
-empty
find empty file
Common use
c
add file in tar file (no compress)
x
decompress or unpack a file from tar
t
show file in tar
z
use gzip
(with compress)
f name.tgz
output a file named name.tgz
Common use
Edit /etc/logrotate.d/log
0 shutdown
1 single user (no network)
2 multiple user (no network)
3 multiple user with network
4 ?
5 multiple user with gui
6 Reboot
edit /etc/inittab
to change default run level
Install openssl package
Generate a private key and request file
Common Name is your domain name
Use Windows Server AD CS to auth this request file and get a public key
Rename the public key
Edit nginx config file
Add ssl configuration
Restart nginx services
Copy public.csr
and rename to public.crt
Move public.crt
to /etc/ssl/certs
Move private.key
/etc/ssl/private
Modify /etc/apache2/site-available/ssl.conf
Download source code
Install tools