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-185154

Ani's questions

Martin Hope
Ani
Asked: 2024-07-27 03:00:40 +0800 CST

当远程是 WinSCP 时,su -l shell 似乎会自动关闭

  • 6

我有一个在调用时调用的脚本ssh(在 Linux 上)来运行一些命令,然后以其他用户身份登录- 当我使用任何基于 Linux的客户端su -l <anotheruser>时,这一切都运行正常。但是当我尝试使用 WinScp(选项中有文件协议)时,它不起作用!在进一步故障排除时,似乎通过调用的 shell不知何故被杀死了!因此,我在 WinScp 日志中看到以下内容:scpssh SCPsu -l <anotheruser>

(EFatal) **Connection has been unexpectedly closed.** Server sent command exit status 1

但我无法弄清楚为什么仅su在使用 WinScp 时登录 shell 才会被终止!有任何指示可以进一步调试吗?

- 编辑 -

WinSCP 日志的最后几行:

! 2024-07-27 00.23.13.824 su: must be run from a terminal
. 2024-07-27 00.23.13.824 Session sent command exit status 1
. 2024-07-27 00.23.13.824 Main session channel closed
. 2024-07-27 00.23.13.824 All channels closed
. 2024-07-27 00.23.13.824 Timeout waiting for network events
. 2024-07-27 00.23.13.824 Waiting for another 1 bytes
. 2024-07-27 00.23.13.824 Looking for incoming data
. 2024-07-27 00.23.13.824 Looking for network events
. 2024-07-27 00.23.13.824 Attempt to close connection due to fatal exception:
* 2024-07-27 00.23.13.824 **Connection has been unexpectedly closed.** Server sent command exit status 1.
. 2024-07-27 00.23.13.824 Closing connection.
. 2024-07-27 00.23.13.824 Selecting events 0 for socket 1932
* 2024-07-27 00.23.13.856 (EFatal) **Connection has been unexpectedly closed.** Server sent command exit status 1.
* 2024-07-27 00.23.13.856 Error skipping startup message. Your shell is probably incompatible with the application (BASH is recommended).

是否

! 2024-07-27 00.23.13.824 su: must be run from a terminal

指出问题!?

我的脚本通过 NSS 插件调用(libnss-ato)

--编辑2--

在使用su具有--pty选项的 util-linux 版本后,winscp 似乎卡住了!日志:

< 2024-08-02 15.00.55.772 tani1@sys7-vm81B$ echo "WinSCP: this is end-of-file:0"
. 2024-08-02 15.00.55.772 Read 31 bytes (18 pending)
< 2024-08-02 15.00.55.772 WinSCP: this is end-of-file:0
. 2024-08-02 15.00.55.772 Read 18 bytes (0 pending)
. 2024-08-02 15.00.55.772 Waiting for another 1 bytes
. 2024-08-02 15.00.55.772 Looking for incoming data
. 2024-08-02 15.00.55.772 Looking for network events
. 2024-08-02 15.01.12.135 Timeout waiting for network events
. 2024-08-02 15.01.12.135 Waiting for data timed out, asking user what to do.
. 2024-08-02 15.01.12.135 Asking user:
. 2024-08-02 15.01.12.135 **Host is not communicating for 15 seconds.
. 2024-08-02 15.01.12.135 
. 2024-08-02 15.01.12.135 Wait for another 15 seconds?** ()
su
  • 1 个回答
  • 69 Views
Martin Hope
Ani
Asked: 2020-07-28 07:39:05 +0800 CST

通过 atd 生成的脚本使进程处于等待状态

  • 0

我有一个bash通过 运行的脚本at,我运行它是 echo "bash /path/to/my/script.sh" | at -M now因为我希望它独立运行。

生成脚本后,我立即看到 2 个实例 ( ps),即使在我的脚本成功完成后,另一个实例也不会终止。它将被重新设置为 pid1并继续等待(strace显示wait4(-1...)。

我无法弄清楚为什么或如何分叉第二个实例!当我在没有 的情况下运行脚本时at,我看不到第二个进程。调试这个的任何提示/提示?

谢谢。

bash at ubuntu-14.04
  • 1 个回答
  • 124 Views
Martin Hope
Ani
Asked: 2020-05-29 00:33:17 +0800 CST

许多脚本实例可以写入 tty(并行)吗?

  • 0

我最近将我的upstart脚本迁移到了systemd,与此不同的是,我在启动/停止服务upstart时看不到任何输出。为了获得视觉反馈,我添加了类似tty

      echo "Starting $UNIT_NAME" > $MYTTY

其中MYTTY是我从tty命令输出设置的环境变量。我有 20 多种服务,但不知何故,并非所有消息都出现在我的 tty 上。所以我将行(只是为了检查)更改为:

      echo "Starting $UNIT_NAME" | write myuser $MYTTY

有了这个,我看到所有的消息都在显示!(当然,还有额外的 Message from <user>@<hostname> on <term> at <time> ... EOF

只是为了检查是否write在做一些特别的事情,我检查了代码,bsdutils我没有发现任何特别之处,它只是逐个字符地编写(对特殊字符和 CR、LF 进行了一些处理)

出什么问题了 :

      echo "Starting $UNIT_NAME" > $MYTTY

? 我也试过:

      echo -e "Starting $UNIT_NAME\r\b" > $MYTTY

等等,但我仍然没有在屏幕上看到来自所有服务的消息!是不是因为并行systemd启动了所有服务,所以一些写入 tty 的内容消失了!?

--

- 编辑 -

以下回合的方式似乎有效!但我想知道这是否安全或有更好/更简单的东西

 mkfifo /tmp/ttyfifo
 (cat > $MYTTY < /tmp/ttyfifo &) && echo -e 'Starting $UNIT_NAME\r\n'  > /tmp/ttyfifo
bash systemd tty
  • 1 个回答
  • 226 Views
Martin Hope
Ani
Asked: 2019-10-10 09:20:06 +0800 CST

基于 rsyslog 表达式的过滤器 - 'startswith' 不起作用

  • 1

我正在尝试将sshd这些日志过滤到一个单独的文件中:

 sshd[14913]: Did not receive identification string from 10.16.0.2

我尝试了以下方法,它奏效了:

if $programname == 'sshd' and
   $syslogfacility-text == 'security' and
   $syslogseverity == '6' then -/var/log/sshinfo.log
& stop

但这也匹配用户登录/注销,所以我尝试添加一个消息匹配过滤器:

if $programname == 'sshd' and
   $msg startswith 'Did not'  and    # <---
   $syslogseverity == '6' then -/var/log/sshinfo.log
& stop

它不起作用!(虽然contains有效)

startswith坏了,还是这种用法不正确?

版本:

# rsyslogd -v
rsyslogd 7.4.4, compiled with:
    FEATURE_REGEXP:             Yes
    FEATURE_LARGEFILE:          No
    GSSAPI Kerberos 5 support:      Yes
    FEATURE_DEBUG (debug build, slow code): No
    32bit Atomic operations supported:  Yes
    64bit Atomic operations supported:  Yes
    Runtime Instrumentation (slow code):    No
    uuid support:               Yes
ubuntu
  • 1 个回答
  • 2306 Views
Martin Hope
Ani
Asked: 2013-08-11 09:42:43 +0800 CST

系统日志到 IPFIX

  • 2

我正在阅读有关以 IPFIX 格式导出的日志(syslog)。有些产品也能做到这一点。我没有找到的是,是否有任何标准/已知的方法可以做到这一点?就像是否有任何用于 syslog 的特定信息元素?或者,它是完全专有的方法(比如使用 IPFIX 中允许的所有供应商特定字段)而且,对于这些方案,是使用普通 IPFIX 还是结构化 IPFIX ?TIA 了解有关此的任何信息/指针。

- 编辑 -

我不是在寻找有关产品的任何信息,只寻找方法/标准(如果有的话)。

syslog
  • 3 个回答
  • 640 Views

Sidebar

Stats

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

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve