我在VirtualBox中有一个Debian/Linux虚拟机。
# uname -a
Linux debian 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux
# vi /etc/motd
##########################
Hi, welcome to the server!
##########################
~
我试图用脚本修改linux机器上的某个文件。该文件是/etc/panam.d/登录文件。问题是文件的内容是,
# Prints the message of the day upon succesful login.
# (Replaces the `MOTD_FILE' option in login.defs)
# This includes a dynamically generated part from /run/motd.dynamic
# and a static (admin-editable) part from /etc/motd.
session opti
我无法找到为什么这个简单的模式似乎不匹配任何东西。我有两个不可靠的主机作为目标。这是我的库存档案:
[web_Xubuntu]
192.168.160.128
[database_Fedora]
192.168.160.132
我的YAML剧本是这样的:
# Hosts: where our play will run and options it will run with
hosts: *Fedora
become: True
#gather_facts: False
# Vars: variables that will apply to the play,
我想要一个动态的motd,但我想不出怎么做。
我尝试了我发现的东西,添加了/etc/update-motd.d/00-header、10-sysinfo、90-footer,并将符号链接到/etc/motd /var/run/motd.dynamic、/run/motd.dynamic、/run/motd或/var/run/motd。
我在/etc/pam.d/sshd中有以下几行:
# Print the message of the day upon successful login.
# This includes a dynamically generated part from /r
我想在fossil单片机系统中保留我的linux配置。
这是我在初始阶段所做的。
$ cd /
$ fossil new b.fsl
$ fossil open b.fsl
$ fossil add etc/group
$ fossil add boot/grub/menu.lst
$ fossil ci -m 'init commit'
我想做这样的事情(像hg/git那样操作)。
$ cd etc
$ fossil status group
$ fossil add motd
它将显示错误消息:
fossil: current directory is not within
在使用内置的printf bash将字符串填充到特定宽度时,我遇到了一个"off-by-one“问题。
使用以下代码:
#!/bin/bash
# vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
# Only display motd if tty and not sudoing as root
[ "$PS1" ] && [ "$EUID" -ne 0 ] || return 0
# Run the entire function in its own subshel
我在下面创建了一个测试脚本,将其添加到/etc/update-motd.d/05-lsb-release
#!/bin/sh
echo
lsb_release -a
但是,当我重新启动机器,重新启动SSH并通过SSH连接到它时,我看不到应用的更改
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-105-generic x86_64)
0 packages can be updated. 0 updates are security updates.
Last login: Sun Dec 11 17:08:40 2016 from xxx.
我正试图在我的OrangePI上用Armbian修改我的motd脚本。只是想画出我的机器的名字,而不是大橙色的PI PC。我发现,我必须编辑/etc/update-motd.d/10-armbian-header。有这样的台词:
if [ $(echo $BOARD_NAME | wc -c) -ge 18 ]; then
TERM=linux toilet -f standard -F metal $(echo $BOARD_NAME | sed 's/Orange Pi/OPi/' | sed 's/Nanopi/NPi/')
else
TE
当通过SSH登录到我的Ubuntu12.04机器时,我遇到了一个问题。在打印一半的MOTD后,它会延迟大约40秒。然后上面写着
[...]: command not found
并完成登录。
我的MOTD在登录时如下所示:
Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.2.0-35-generic-pae i686)
* Documentation: https://help.ubuntu.com/
Last login: Sat Oct 5 20:37:30 2013 from windows
[...]: command not found
无法在Amazon Linux AMI上安装libatk-bridge-2.0.so.0。给出以下响应
>sudo yum install libatk-bridge-2.0.so.0
Response: Loaded plugins: priorities, update-motd, upgrade-helper
No package libatk-bridge-2.0.so.0 available.
Error: Nothing to do
操作系统: Amazon Linux AMI 2018.03版内核\r在\m上
我使用SSH从Ubuntu连接到Raspberry (主机名"pi0alby")。几个月来一切都很好。现在,在一天开始的时候,登录很好,但是会话很快就关闭了,如下所示:
. --- --- /etc/motd --------------------(this is the end of MOTD message)-------- .
No mail.
Last login: Fri Oct 16 11:24:23 2020 from 192.168.1.59
sebas@pi0alby:~ $ Connection to r0 closed.
我通常使用的命令是“sebas@
我知道pam_motd在登录时更新了MOTD,但是有时候MOTD只是几天没有更新,我很困惑是什么原因。我想将uptime和who输出添加到MOTD中,从/etc/update-motd.d/脚本中正确地调用它们,但是如果向用户显示过时的信息似乎是毫无意义的。
来自update-motd手册页:
Executable scripts in /etc/update-motd.d/* are executed by pam_motd(8) as
the root user at each login, and this information is concatenated in /var/r
出于某种原因,我昨天从标准"Debian /Linux附带绝对没有保修的.“中编辑了motd文件。我自己定制的信息。系统今天重新启动后,我的自定义消息就消失了,它返回到:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux com
我和debian jessie一起做了个VPS。当我通过ssh连接时,我想要动态的motd显示。我试过
update-rc.d motd defaults
(不提供输出),systemctl enable motd给出:
update-rc.d: warning: enable action will have no effect on runlevel 1
Failed to execute operation: No such file or directory
systemctl status motd说:
motd.service
Loaded: masked (/dev/nul
根据motd.tail,这个错误报告是不推荐的:
motd(5) says: "The contents of this file are regenerated upon every system
boot based on the contents of /etc/motd.tail." This is not true anymore, as
Ubuntu uses the update-motd framework. Any reference to motd.tail should be
replaced with a reference to the update-
如果用户在第一个提示中输入y,我将尝试跳过接下来的三个提示。 ---
- name: User MOTD Script
hosts: localhost
vars_prompt:
- name: "defaultMOTD"
prompt: "Do you want to set the MOTDs to the default? (y/n)"
private: no
- name: "MOTD"
prompt: "Please input your M
我准备运行这个ansible脚本。
---
- name: User MOTD Script
hosts: localhost
vars_prompt:
- name: "defaultMOTD"
prompt: "Do you want to set the MOTDs to the default? (y/n)"
private: no
- name: "MOTD"
prompt: "Please input your MOTD for /etc/mo