AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-528454

SebMa's questions

Martin Hope
SebMa
Asked: 2025-01-30 17:30:05 +0800 CST

如何在 sudoers 中允许 find 但禁止 find -exec

  • 8

我试图允许 sudoers 中的 find 命令但禁止find ... -exec rm或find ... -delete。

以下是我所做的:

$ sudo grep find /etc/sudoers.d/myUser
myUser ALL=!/usr/bin/find * -exec *
myUser ALL=!/usr/bin/find * -delete *
myUser ALL=/usr/bin/find *
$

但是当我尝试 find * -exec 命令时,它可以工作而不是被禁止:

$ sudo su - myUser
$ sudo find var/www/html/ ! -type d -exec ls -l {} +
lrwxrwxrwx 1 adn adn 23 Mar 21  2023 var/www/html/index.html -> index.nginx-debian.html
$

我怎样才能做到这一点?

linux
  • 1 个回答
  • 377 Views
Martin Hope
SebMa
Asked: 2024-10-07 21:39:07 +0800 CST

haproxy 根据 fqdn 将 ssh 中继到后端:kex_exchange_identification:远程主机关闭连接

  • 6

我正在尝试根据 FQDN 将 ssh 连接从端口 122/tcp 中继到端口 22/tcp 上的另一台服务器。

这是我的 HAProxy 配置:

frontend my_ssh_frontend
    bind *:122
    mode tcp
    option tcplog
    acl my_ssh_acl hdr(host) myHostname.myDomain.com
    use_backend my_ssh_backend if my_ssh_acl

backend my_ssh_backend
    mode tcp
    server myserver1 x2.y2.z2.t2:22 check

但就好像 ACL 条件永远不成立,因此流量不会被路由到后端。

输出如下ssh -vvv:

 ssh.exe -p 122 -l admin-media myHostname.myDomain.com -vvv 2>&1 | egrep.exe -vw "identity file|Failed to open"
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug2: resolving "myHostname.myDomain.com" port 122
debug2: ssh_connect_direct
debug1: Connecting to myHostname.myDomain.com [x1.y1.z1.t1] port 122.
debug1: Connection established.
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
kex_exchange_identification: Connection closed by remote host

我如何使用 HAProxy 来实现这一点?

ssh
  • 1 个回答
  • 19 Views
Martin Hope
SebMa
Asked: 2024-02-22 00:35:58 +0800 CST

如何rsync到没有rsync但有SCP工具的服务器

  • 5

远程服务器是一个类似 FreeBSD 的系统,未安装 rsync:

$ ssh [email protected] which rsync scp
Password:
rsync not found
/usr/local/bin/scp
$ rsync -a /ring/0/share/Archives_AudioVisuel/TEST [email protected]:/ifs/par-nas01/data/MPP/ADN_Archives/Audiovisuels/
Password:
zsh:1: command not found: rsync
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: remote command not found (code 127) at io.c(226) [sender=3.1.2]
$

我尝试添加-e ssh,但收到同样的错误,说rsync是not found。

如果我尝试添加--rsync-path=/usr/local/bin/scp,但随后会出现scp: illegal option -- -错误。

如何rsync对只有该工具的服务器进行操作scp?

linux
  • 1 个回答
  • 47 Views
Martin Hope
SebMa
Asked: 2024-02-03 02:22:07 +0800 CST

C:\Users\Default 和 C:\Users\Default User 文件夹有什么区别?

  • 6

C:\Users\Default和文件夹有什么区别C:\Users\Default User?

PS $ & "$HOME/psh/dirsize.ps1" "C:\Users\Default"

  2.01 MiB


PS $ & "$HOME/psh/dirsize.ps1" "C:\Users\Default User"

  dir : Access to the path "C:\Users\Default User" is denied.
  At C:\Users\t2-sma\psh\dirsize.ps1:2 char:21
    + "{0:n2} MiB" -f ( ( dir $dirName -force -recurse | measure -property  ...
    +                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : PermissionDenied: (C:\Users\Default User:String) [Get-ChildItem], UnauthorizedAccessException
      + FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand

  0.00 MiB
  • 和 都C:\Users\Default存在C:\Users\Default User:
    PS $ dir "C:\Users" -Force | ? Name -like 'Default*'
    
      Directory: C:\Users
    
        Mode          LastWriteTime  Length  Name
        ----          -------------  ------  ----
        d-rh--   31/05/2023   10:58          Default
        d--hsl   07/12/2019   10:30          Default User
    

  • dir说C:\Users\Default User是一个结点,但令人惊讶的是 PowerShell 什么也没说:
    $ dir /a "C:\Users" | findstr Default
    
      31/05/2023  09:58    <DIR>          Default
      07/12/2019  10:30    <JUNCTION>     Default User [C:\Users\Default]
    
    
    PS $ (gi "C:\Users\Default User\" -Force).LinkType
    
    
windows
  • 2 个回答
  • 60 Views
Martin Hope
SebMa
Asked: 2023-07-26 03:21:13 +0800 CST

尽管我已启用它,为什么我的 systemd 计时器仍显示在非活动计时器中?

  • 5

我创建了以下 SystemD 计时器和服务并启用了计时器:

$ sudo install -vpm 644 ncc-record.* /usr/local/lib/systemd/system/
'ncc-record.service' -> '/usr/local/lib/systemd/system/ncc-record.service'
'ncc-record.timer' -> '/usr/local/lib/systemd/system/ncc-record.timer'
$ sudo systemctl daemon-reload
$ systemctl cat ncc-record.*
# /usr/local/lib/systemd/system/ncc-record.service
[Unit]
Description=Record the New Creation Church Live sermon
After=network-online.target

[Service]
Type=oneshot
User=sebastien
Group=sebastien
#UMask=026
ExecStart=/home/sebastien/myScripts/shl/record_NCC_Live_Then_Suspend.sh

# /usr/local/lib/systemd/system/ncc-record.timer
[Unit]
Description=Trigger the service record.service
[Timer]
OnCalendar=Sun *-*-* 11:29:30
[Install]
WantedBy=timers.target
$ sudo systemctl enable ncc-record.timer 
Created symlink /etc/systemd/system/timers.target.wants/ncc-record.timer → /usr/local/lib/systemd/system/ncc-record.timer.
$

我的计时器没有显示在活动计时器中:

$ systemctl list-timers | grep ncc
$

但它在非活动计时器中显示,没有有关下一个、左、最后和通过时间的信息:

$ systemctl list-timers --state=inactive | grep ncc
n/a                          n/a           n/a                          n/a           ncc-record.timer               ncc-record.service
$

我怎样才能解决这个问题 ?

linux
  • 1 个回答
  • 9 Views
Martin Hope
SebMa
Asked: 2023-07-25 00:30:45 +0800 CST

如何将 smartctl 与一个 raid 控制器一起使用

  • 7

我使用 PERC H730 Mini raid 控制器:

# lspci -d::0104 -k
02:00.0 RAID bus controller: Broadcom / LSI MegaRAID SAS-3 3108 [Invader] (rev 02)
        Subsystem: Dell PERC H730 Mini
        Kernel driver in use: megaraid_sas
        Kernel modules: megaraid_sas

这是连接到服务器的磁盘:

# lsscsi -s
[0:2:0:0]    disk    DELL     PERC H730 Mini   4.28  /dev/sda    499GB
[0:2:1:0]    disk    DELL     PERC H730 Mini   4.28  /dev/sdb   8.00TB
[0:2:2:0]    disk    DELL     PERC H730 Mini   4.28  /dev/sdc   8.00TB
[0:2:3:0]    disk    DELL     PERC H730 Mini   4.28  /dev/sdd   8.00TB
[0:2:4:0]    disk    DELL     PERC H730 Mini   4.28  /dev/sde   8.00TB
[0:2:5:0]    disk    DELL     PERC H730 Mini   4.28  /dev/sdf   8.00TB
[0:2:6:0]    disk    DELL     PERC H730 Mini   4.28  /dev/sdg   8.00TB
[0:2:7:0]    disk    DELL     PERC H730 Mini   4.28  /dev/sdh   8.00TB
[0:2:8:0]    disk    DELL     PERC H730 Mini   4.28  /dev/sdi   8.00TB
[0:2:9:0]    disk    DELL     PERC H730 Mini   4.28  /dev/sdj   8.00TB
[0:2:10:0]   disk    DELL     PERC H730 Mini   4.28  /dev/sdk   8.00TB
[0:2:11:0]   disk    DELL     PERC H730 Mini   4.28  /dev/sdl   8.00TB
[0:2:12:0]   disk    DELL     PERC H730 Mini   4.28  /dev/sdp   8.00TB
[0:2:13:0]   disk    DELL     PERC H730 Mini   4.28  /dev/sdm   8.00TB
[0:2:14:0]   disk    DELL     PERC H730 Mini   4.28  /dev/sdn   8.00TB
[0:2:15:0]   disk    DELL     PERC H730 Mini   4.28  /dev/sdq   8.00TB
[0:2:16:0]   disk    DELL     PERC H730 Mini   4.28  /dev/sdo    399GB

On smartctl,我以为设备名称是denoting which disk on the controller is monitored.

但是,当使用一个 RAID 控制器时,smartctl也需要The non-negative integer N (in the range of 0 to 127 inclusive) denotes which disk on the controller is monitored.并在值不同时给出完全不同的结果N:

# smartctl -i /dev/sdq -d megaraid,0 -j | jq -r .model_name,.user_capacity.bytes
INTEL SSDSC2BX400G4R
400088457216
# smartctl -i /dev/sdq -d megaraid,1 -j | jq -r .model_name,.user_capacity.bytes
SEAGATE ST8000NM0075
8001563222016

似乎使用N=0返回了错误的磁盘,因为容量与输出的容量不匹配lsscsi -s。

如何选择合适的N值smartctl?

raid
  • 1 个回答
  • 50 Views
Martin Hope
SebMa
Asked: 2023-06-28 23:03:50 +0800 CST

删除 Synology NAS 上的 @SynoEAStream 空文件是否安全?

  • 5

我想知道是什么@eaDir在 Synology NAS 共享文件系统中生成这些目录。

我需要清理 Synology NAS 上的空文件。

删除@eaDir/*@SynoEAStream空文件安全吗?

或者更好的是我可以删除这些@eaDir目录吗?

synology-diskstation
  • 1 个回答
  • 17 Views
Martin Hope
SebMa
Asked: 2023-05-31 21:07:08 +0800 CST

如何防止 systemd 在重启后运行我的计时器

  • 5

我有以下 oneshot 服务+计时器:

$ systemctl cat stop_syncro.service stop_syncro.timer
# /usr/local/lib/systemd/system/stop_syncro.service
[Unit]
Description=Service d_arret de la Synchro
After=network-online.target

[Service]
Type=oneshot
User=root
ExecStart=/root/shl/RUN/stop_syncro.sh

[Install]
WantedBy=multi-user.target

# /usr/local/lib/systemd/system/stop_syncro.timer
[Unit]
Description=Timer d_arret de la Synchro
[Timer]
OnCalendar=Mon-Fri *-*-* 8:00:00
[Install]
WantedBy=timers.target

然后我重新启动了服务器:

$ last reboot | head -1
reboot   system boot  3.10.0-1160.71.1 Tue May 30 17:53 - 15:02  (21:09)

并且服务似乎在重启后立即运行

$ journalctl -u stop_syncro.service
-- Logs begin at Tue 2023-05-30 17:53:15 CEST, end at Wed 2023-05-31 14:48:17 CEST. --
May 30 17:53:26 PAR-SCAL-01 systemd[1]: Starting Service d_arret de la Synchro...
May 30 17:53:27 PAR-SCAL-01 systemd[1]: Started Service d_arret de la Synchro...
May 31 08:00:01 PAR-SCAL-01 systemd[1]: Starting Service d_arret de la Synchro...
May 31 08:00:02 PAR-SCAL-01 systemd[1]: Started Service d_arret de la Synchro...
$ 

如何防止我的 oneshot 服务仅在早上 8 点触发,而不是在重启后启动?

linux
  • 1 个回答
  • 23 Views
Martin Hope
SebMa
Asked: 2023-05-25 18:36:37 +0800 CST

CentOS7 上的 SystemD 计时器错误:无法解析日历规范,忽略:Mon..Sat *-*-* 18:00:00

  • 5

我的计时器在 CentOS7 上被系统拒绝:

$ journalctl -u synchro_ADN_To_Scality.timer --no-pager | sed 's/^.*systemd.1.: //' | sort -u
-- Logs begin at Thu 2023-04-06 10:25:28 CEST, end at Thu 2023-05-25 12:29:08 CEST. --
synchro_ADN_To_Scality.timer lacks value setting. Refusing.
[/usr/local/lib/systemd/system/synchro_ADN_To_Scality.timer:4] Failed to parse calendar specification, ignoring: Mon..Sat *-*-* 18:00:00
$ systemctl cat synchro_ADN_To_Scality.timer
# /usr/local/lib/systemd/system/synchro_ADN_To_Scality.timer
[Unit]
Description=Lancement quotidien de la Synchro des Synology ADN vers le Ring Scality
[Timer]
OnCalendar=Mon..Sat *-*-* 18:00:00
[Install]
WantedBy=timers.target

我在手册中看不到日期范围systemd.time:

$ man systemd.time | grep -F ".."
$

CentOS7 不识别日期范围吗?

bash
  • 1 个回答
  • 9 Views
Martin Hope
SebMa
Asked: 2023-04-06 17:44:01 +0800 CST

为什么 $XDG_RUNTIME_DIR (/run/user/$UID) 目录不是在“su - user”之后创建的?

  • 5

为什么在“su - user”之后没有创建 $XDG_RUNTIME_DIR (/run/user/$UID) 目录?:

administrateur@localhost:~$ su - test
Password:
test@localhost:~$ systemctl --user
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)
test@localhost:~$ ls /run/user/$UID
ls: cannot access '/run/user/1004': No such file or directory
test@localhost:~$ groups
test
test@localhost:~$
logout
administrateur@localhost:~$

EDIT0:做 asudo loginctl enable-linger test保留/run/user/$UID目录,但XDG_RUNTIME_DIR变量仍未定义:

administrateur@localhost:~$ sudo loginctl enable-linger test
administrateur@localhost:~$ sudo su - test
test@localhost:~$ ls /run/user/$UID/bus
/run/user/1004/bus
test@localhost:~$ echo $XDG_RUNTIME_DIR

test@localhost:~$ 
logout
administrateur@localhost:~$
xdg
  • 1 个回答
  • 29 Views
Martin Hope
SebMa
Asked: 2020-02-28 07:33:24 +0800 CST

如何在恢复时重新启动 systemd 服务

  • 9

我有以下服务配置:

$ systemctl cat bluetooth
# /lib/systemd/system/bluetooth.service
[Unit]
Description=Bluetooth service
Documentation=man:bluetoothd(8)
ConditionPathIsDirectory=/sys/class/bluetooth

[Service]
Type=dbus
BusName=org.bluez
ExecStart=/usr/lib/bluetooth/bluetoothd
NotifyAccess=main
#WatchdogSec=10
#Restart=on-failure
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
LimitNPROC=1
#RestartSec=5

[Install]
WantedBy=bluetooth.target suspend.target
Alias=dbus-org.bluez.service

我在部分 ( )suspend.target的WantedBy=参数中添加了要在恢复时重新启动的服务,但这不起作用。[Install]man systemd.unit

EDIT0:该服务不会在挂起时停止,但需要在恢复后重新启动,因为该服务不支持我的配置上的挂起/恢复操作。

EDIT1:suspend.target也应该工作,因为根据man systemd.special:

   suspend.target
       A special target unit for suspending the system. This pulls in sleep.target.

EDIT2:似乎该命令sudo systemctl edit --full bluetooth创建了另一个副本,一旦保存文件bluetooth.service,该副本/etc/systemd/system/bluetooth.service就变得不同(从)。/lib/systemd/system/bluetooth.service

我刚刚注意到我有两个不同的版本,bluetooth.service所以我有点困惑。

如何在恢复后重新启动 systemd 服务?

linux systemd
  • 2 个回答
  • 3803 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Vickel Firefox 不再允许粘贴到 WhatsApp 网页中? 2023-08-18 05:04:35 +0800 CST
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve