小编tij*_*agi的帖子

ntpd:服务器卡在 .INIT 上

我正在尝试为本地网络设置 NTP 服务器,但 ntpd 拒绝与外部服务器同步。

# ntptrace
localhost: stratum 16, offset 0.000000, synch distance 0.396285

# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 31.135.95.60    .INIT.          16 u    - 1024    0    0.000    0.000   0.000
 31.131.249.26   .INIT.          16 u    - 1024    0    0.000    0.000   0.000
 91.122.42.73    .INIT.          16 u    - 1024    0    0.000    0.000   0.000
 194.190.168.1   .INIT.          16 u    - 1024    0    0.000    0.000   0.000
Run Code Online (Sandbox Code Playgroud)

我使用的配置几乎是默认的:

# grep ^[^#] /etc/ntp.conf 
server 0.gentoo.pool.ntp.org
server 1.gentoo.pool.ntp.org
server 2.gentoo.pool.ntp.org …
Run Code Online (Sandbox Code Playgroud)

ntp ntpd

10
推荐指数
1
解决办法
4万
查看次数

如何让用户在 sudoers 中执行包含引号的命令?

我有这个命令

chroot /chroots/box /bin/bash -c 'cd /repos/system && git pull'
Run Code Online (Sandbox Code Playgroud)

我试着写在 /etc/sudoers

user ALL = (root) NOPASSWD: chroot /chroots/box /bin/bash -c 'cd /repos/system && git pull'
Run Code Online (Sandbox Code Playgroud)

但这没有用。在我见过的日志中

sudo:      user : command not allowed ; TTY=pts/7 ; PWD=/home/user ; USER=root ; COMMAND=chroot /chroots/box /bin/bash -c cd /repos/system && git pull
Run Code Online (Sandbox Code Playgroud)

我还尝试在 sudo 调用中转义引号,例如\',并且它们出现在具有相同错误的日志文件中。

这个 repo 影响了 chroot 的根文件系统,所以我不能从外面调用 git pull 。

linux sudo

7
推荐指数
1
解决办法
4486
查看次数

无法从 Windows 上的 linux 服务器挂载 NFS 共享

有一个支持 NFS v3 和 4 的 linux 服务器,以及一个运行 NFS 客户端服务的 WinXP 虚拟机。XP 可以 ping 服务器,但不能挂载 NFS 共享。

从 /etc/exports:

/home/files              
192.168.0.0/24(ro,all_squash,anonuid=1003,anongid=1003,insecure,no_subtree_check)
Run Code Online (Sandbox Code Playgroud)

--debug选项传递给nfsd,但在 /var/log/messages 中没有看到相应的输出。看起来请求根本没有到达服务器。

当我运行时在 Windows 上

mount 192.168.0.1:\home\files Z:
Run Code Online (Sandbox Code Playgroud)

我有

ERROR — Invalid command line argument
mount 192.168.0.1:\home\files Z:
      ^^^^^^^^^^^^^^^^^^^^^^^
Run Code Online (Sandbox Code Playgroud)

如果我去

net use Z: 192.168.0.1:\home\files
Run Code Online (Sandbox Code Playgroud)

它抛出

System error 67 has occurred. 
The network name cannot be found.
Run Code Online (Sandbox Code Playgroud)

小改地址后

net use Z: \\192.168.0.1\home\files
Run Code Online (Sandbox Code Playgroud)

它跳过一秒钟然后给出另一个错误:

System error 1231 has occurred.
The network location cannot be reached. For information …
Run Code Online (Sandbox Code Playgroud)

linux windows windows-xp nfs

3
推荐指数
1
解决办法
2万
查看次数

GNU 屏幕:'无法打开您的终端'/dev/pts/3' - 请检查'

我的系统中有一个守护进程,它在一个屏幕实例内运行,所有这些都是由一个非特权用户完成的。我已将自己添加到特殊的 sudo 组,允许我从该用户运行 screen,但是当我尝试使用它时,例如

sudo -u that_user -H /usr/bin/screen -R
Run Code Online (Sandbox Code Playgroud)

我明白了这篇文章的主题。

四处挖掘我发现此消息意味着屏幕无法抓取或输出到我在调用它时实际使用的 pty。对此的常见答案是将我的 /dev/pts/N chmod 为其他人的 rw,但我记得我以某种方式设法较早地避免了这种情况。也许我错过了为 sudo 保存一些环境?

特别是我试图通过 sudo 从普通用户连接到在屏幕上运行的 rtorrent 守护程序,操作系统是 Gentoo amd64。以下是从 rc 脚本调用 screen 的方式:

    start-stop-daemon \
        --start \
        --make-pidfile \
        --pidfile /var/run/rtorrentd.pid \
        --background \
        --user $USER \
        --env HOME="${PWHOME:-/home/$USER}" \
        --name rtorrent \
        --exec /usr/bin/screen -- -D -m -S rtorrentd /usr/bin/rtorrent
Run Code Online (Sandbox Code Playgroud)

终于找到了实际的解决方案:

alias rtorrent="urxvt -hold -e /bin/bash -c \"chmod o+rw \\\`tty\\\` && sudo -u rtorrent -H screen -r rtorrentd\""
Run Code Online (Sandbox Code Playgroud)

sudo gnu-screen

2
推荐指数
1
解决办法
6082
查看次数

标签 统计

linux ×2

sudo ×2

gnu-screen ×1

nfs ×1

ntp ×1

ntpd ×1

windows ×1

windows-xp ×1