Alt+T打开终端,输入sudo ufw status回车,查看防火墙状态,inactive是关闭,active是开启
sudo ufw status
sudo ufw enable
sudo ufw disable
设置文件最大打开数
# 系统
vim /etc/sysctl.conf
# 添加
fs.file-max = 1024000
sysctl -p
# 用户
vim /etc/security/limits.conf
# 添加
* hard nofile 1024000
* soft nofile 1024000
root hard nofile 1024000
root soft nofile 1024000
# Systemd
sed -i '/DefaultLimitNOFILE/c DefaultLimitNOFILE=1024000' /etc/systemd/*.conf
systemctl daemon-reexec
重启后验证
# 打开新的终端
# ssh remote_user@host
# 查看系统限制
cat /proc/sys/fs/file-max
# 查看用户硬限制
ulimit -Hn
# 查看用户软限制
ulimit -Sn
# 查看某进程的限制
cat /proc/PID/limits # 将 PID 替换为具体的进程 ID
# 查看其他用户限制
su - www -c 'ulimit -aHS' -s '/bin/bash'
当前系统时间
root@suanyun:/boot# date
Fri Dec 16 02:22:28 AM UTC 2022
查看当前系统时间及对应时区
root@suanyun:/boot# timedatectl
Local time: Fri 2022-12-16 02:23:15 UTC
Universal time: Fri 2022-12-16 02:23:15 UTC
RTC time: Fri 2022-12-16 02:23:15
Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
罗列可用时区
root@suanyun:/boot# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
Africa/Brazzaville
Africa/Bujumbura
Africa/Cairo
Africa/Casablanca
Africa/Ceuta
Africa/Conakry
Africa/Dakar
Africa/Dar_es_Salaam
Africa/Djibouti
Africa/Douala
Africa/El_Aaiun
Africa/Freetown
Africa/Gaborone
Africa/Harare
Africa/Johannesburg
设置时区
root@suanyun:/boot# sudo timedatectl set-timezone Asia/Shanghai
root@suanyun:/boot#
从ntp同步时间
apt install ntp
vim /etc/ntp.conf
#linux自带的时间同步,需要注释掉
#pool 0.ubuntu.pool.ntp.org iburst
#pool 1.ubuntu.pool.ntp.org iburst
#pool 2.ubuntu.pool.ntp.org iburst
#pool 3.ubuntu.pool.ntp.org iburst
# Use Ubuntu's ntp server as a fallback.
#pool ntp.ubuntu.com
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
#增加254作为时间服务器即可
server 192.168.33.254
# Needed for adding pool entries
restrict source notrap nomodify noquery
重启ntp
sudo service ntp restart
在ntp sever上执行 ntpq -p
在ntp client上执行 ntpq –p
算芸网络科技
算芸网络科技
算芸网络科技
算芸网络科技
算芸网络科技
温馨提示:1、本内容转载于网络,版权归原作者所有!2、本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。3、本内容若侵犯到你的版权利益,请联系我们,会尽快给予删除处理!