systemctl重新加载_对/etc/systemd/system.conf的更改重新启动或“systemctl daemon-reload”?...

不,daemon-reload将重新加载所有单元文件,而不是systemd本身的配置.但是,#systemctl daemon-reexec将重新执行systemd并使其在此过程中消化其新配置.

从systemctl手册页:

daemon-reexec

Reexecute the systemd manager. This will serialize the manager

state, reexecute the process and deserialize the state again. This

command is of little use except for debugging and package upgrades.

Sometimes, it might be helpful as a heavy-weight daemon-reload.

While the daemon is being reexecuted, all sockets systemd listening

on behalf of user configuration will stay accessible.

当手册页说daemon-reexec对包升级有用时,它在很大程度上意味着该命令执行任何新的二进制文件并重新处理其配置.但是,我们用于升级systemd的RPM已经包含了执行此操作的脚本,因此在正常升级的情况下通常不需要它.

或者你可以重启.要么会这样做.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
逐条注释 ``` getenforce setenforce 0 cp /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/sshd.old.service sed -i -e 's/^Type=.*/Type=simple/g' -e '/ExecStart=/{s/\/usr\/sbin\/sshd/\/usr\/local\/sbin\/sshd/g}' /usr/lib/systemd/system/sshd.service sed -i "s/GSSAPIAuthentication/#GSSAPIAuthentication/" /etc/ssh/sshd_config sed -i "s/GSSAPICleanupCredentials/#GSSAPICleanupCredentials/" /etc/ssh/sshd_config sed -i "s/#PermitRootLogin yes/PermitRootLogin yes/" /etc/ssh/sshd_config sed -i "s/#UsePAM yes/UsePAM yes/" /etc/ssh/sshd_config chmod 600 /etc/ssh/ssh_host_rsa_key chmod 600 /etc/ssh/ssh_host_ecdsa_key chmod 600 /etc/ssh/ssh_host_ed25519_key mv /usr/local/sbin/sshd /usr/local/sbin/sshd.old202211 mv /lib64/libcrypto.so.1.1 /lib64/libcrypto.so.1.1.old202211 mv /srv/libcrypto.so.1.1 /lib64/ mv /srv/sshd /usr/local/sbin/ chmod 755 /usr/local/sbin/sshd chmod 755 /lib64/libcrypto.so.1.1 systemctl daemon-reload systemctl restart sshd.service source /etc/profile sshd -V useradd secure echo 'Ofm#6%3%fm0IWH'|passwd --stdin secure echo "secure ALL=(ALL) ALL" >> /etc/sudoers sed -i "s/PermitRootLogin yes/PermitRootLogin no/" /etc/ssh/sshd_config service sshd restart systemctl daemon-reload systemctl restart sshd.service sed -i "s/secure ALL=(ALL) ALL/secure ALL=(ALL) NOPASSWD: ALL/" /etc/sudoers chage -M 99999 secure sleep 2 useradd aqassoc echo 'dAxgDt^7LT' | passwd --stdin aqassoc mkdir /batshell chown -R aqassoc:aqassoc /batshell echo 'aqassoc ALL=(ALL) NOPASSWD:ALL,!/bin/su,!/sbin/init,!/sbin/shutdown,!/sbin/halt,!/sbin/reboot,!/usr/sbin/visudo,!/usr/bin/passwd' >> /etc/sudoers sh /srv/script.sh sleep 2 tar -xvf /srv/ssl-1.1.1o* -C /srv/ mv /usr/bin/openssl /usr/bin/openssl.old mv /usr/include/openssl /usr/include/openssl.old cp /etc/ld.so.conf /etc/ld.so.conf.old ln -s /srv/ssl-1.1.1o/bin/openssl /usr/bin/openssl ln -s /srv/ssl-1.1.1o/include/openssl /usr/include/openssl srvlib=`cat /etc/ld.so.conf | grep '/srv/ssl-1.1.1o/lib/' | wc -l` if [ $srvlib -eq 0 ];then sed -i 's/\/srv/#\/srv/'g /etc/ld.so.conf echo '/srv/ssl-1.1.1o/lib/' >> /etc/ld.so.conf else echo 'ssl-1.1.1n is ok!' fi ldconfig -v |grep ssl openssl version rm -rf /srv/root_password.sh rm -rf /srv/ssl-1.1.1o_7.tar.gz curl --connect-timeout 10 -# http://133.64.86.246/iso/shell/initialization.sh -o /tmp/initialization.sh # 只有两个参数 dcn/dmz netbond/netskip baseline/baseskip sh /tmp/initialization.sh dcn netbond/netskip baseline/baseskip ```
07-15
以下是对每个命令的逐条注释: ``` getenforce ``` 显示SELinux的执行模式。 ``` setenforce 0 ``` 禁用SELinux。 ``` cp /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/sshd.old.service ``` 备份sshd.service文件。 ``` sed -i -e 's/^Type=.*/Type=simple/g' -e '/ExecStart=/{s/\/usr\/sbin\/sshd/\/usr\/local\/sbin\/sshd/g}' /usr/lib/systemd/system/sshd.service ``` 修改sshd.service文件中的Type和ExecStart路径。 ``` sed -i "s/GSSAPIAuthentication/#GSSAPIAuthentication/" /etc/ssh/sshd_config ``` 注释掉sshd_config文件中的GSSAPIAuthentication行。 ``` sed -i "s/GSSAPICleanupCredentials/#GSSAPICleanupCredentials/" /etc/ssh/sshd_config ``` 注释掉sshd_config文件中的GSSAPICleanupCredentials行。 ``` sed -i "s/#PermitRootLogin yes/PermitRootLogin yes/" /etc/ssh/sshd_config ``` 取消注释sshd_config文件中的PermitRootLogin行。 ``` sed -i "s/#UsePAM yes/UsePAM yes/" /etc/ssh/sshd_config ``` 取消注释sshd_config文件中的UsePAM行。 ``` chmod 600 /etc/ssh/ssh_host_rsa_key chmod 600 /etc/ssh/ssh_host_ecdsa_key chmod 600 /etc/ssh/ssh_host_ed25519_key ``` 设置ssh_host_rsa_key、ssh_host_ecdsa_key和ssh_host_ed25519_key文件的权限为600。 ``` mv /usr/local/sbin/sshd /usr/local/sbin/sshd.old202211 mv /lib64/libcrypto.so.1.1 /lib64/libcrypto.so.1.1.old202211 mv /srv/libcrypto.so.1.1 /lib64/ mv /srv/sshd /usr/local/sbin/ chmod 755 /usr/local/sbin/sshd chmod 755 /lib64/libcrypto.so.1.1 systemctl daemon-reload systemctl restart sshd.service ``` 备份并移动sshd和libcrypto.so.1.1文件,设置权限,并重新加载和重启sshd服务。 ``` source /etc/profile sshd -V ``` 加载/etc/profile文件中的环境变量,并显示sshd的版本信息。 ``` useradd secure echo 'Ofm#6%3%fm0IWH'|passwd --stdin secure echo "secure ALL=(ALL) ALL" >> /etc/sudoers sed -i "s/PermitRootLogin yes/PermitRootLogin no/" /etc/ssh/sshd_config service sshd restart systemctl daemon-reload systemctl restart sshd.service sed -i "s/secure ALL=(ALL) ALL/secure ALL=(ALL) NOPASSWD: ALL/" /etc/sudoers chage -M 99999 secure sleep 2 ``` 创建用户secure并设置密码,将用户secure加入sudoers文件,修改sshd_config文件以禁止root登录,重启sshd服务,并将用户secure的权限更改为无需输入密码执行任意命令,设置密码有效期限为99999天。 ``` useradd aqassoc echo 'dAxgDt^7LT' | passwd --stdin aqassoc mkdir /batshell chown -R aqassoc:aqassoc /batshell echo 'aqassoc ALL=(ALL) NOPASSWD:ALL,!/bin/su,!/sbin/init,!/sbin/shutdown,!/sbin/halt,!/sbin/reboot,!/usr/sbin/visudo,!/usr/bin/passwd' >> /etc/sudoers sh /srv/script.sh sleep 2 ``` 创建用户aqassoc并设置密码,创建/batshell目录并设置所有权和组,将用户aqassoc加入sudoers文件,运行/srv/script.sh脚本,延迟2秒。 ``` tar -xvf /srv/ssl-1.1.1o* -C /srv/ mv /usr/bin/openssl /usr/bin/openssl.old mv /usr/include/openssl /usr/include/openssl.old cp /etc/ld.so.conf /etc/ld.so.conf.old ln -s /srv/ssl-1.1.1o/bin/openssl /usr/bin/openssl ln -s /srv/ssl-1.1.1o/include/openssl /usr/include/openssl srvlib=`cat /etc/ld.so.conf | grep '/srv/ssl-1.1.1o/lib/' | wc -l` if [ $srvlib -eq 0 ];then sed -i 's/\/srv/#\/srv/'g /etc/ld.so.conf echo '/srv/ssl-1.1.1o/lib/' >> /etc/ld.so.conf else echo 'ssl-1.1.1n is ok!' fi ldconfig -v |grep ssl openssl version ``` 解压缩ssl-1.1.1o文件到/srv/目录,备份并移动openssl和openssl目录,备份和修改ld.so.conf文件,检查是否包含/srv/ssl-1.1.1o/lib/路径,刷新动态链接库缓存并显示包含"ssl"字符串的库,显示OpenSSL的版本信息。 ``` rm -rf /srv/root_password.sh rm -rf /srv/ssl-1.1.1o_7.tar.gz curl --connect-timeout 10 -# http://133.64.86.246/iso/shell/initialization.sh -o /tmp/initialization.sh ``` 删除/srv/root_password.sh和/srv/ssl-1.1.1o_7.tar.gz文件,并从指定URL下载initialization.sh脚本到/tmp/initialization.sh。 ``` # 只有两个参数 dcn/dmz netbond/netskip baseline/baseskip sh /tmp/initialization.sh dcn netbond/netskip baseline/baseskip ``` 运行/tmp/initialization.sh脚本,并传递参数dcn、netbond/netskip和baseline/baseskip。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值