在我的公司,当我登录某些服务器时,会显示我上次登录和一个巨大的横幅:
me@my-laptop$ ssh the-server
Last login: Mon Feb 8 18:54:36 2016 from my-laptop.company.com
************************************************************************
* *
* C O M P A N Y I N F O R M A T I O N S Y S T E M S *
* *
* !WARNING! Your connection has been logged !WARNING! *
* *
* This system is for the use of authorized personnel only. *
* Individuals using this *computer system without authorization, *
* or in …
Run Code Online (Sandbox Code Playgroud) 我编辑了 default/etc/update-motd.d/00-header
,添加了一些颜色以使其更易于阅读:
printf "Welcome to \e[1;34m%s\e[0m \e[2m(%s %s %s)\e[0m\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
Run Code Online (Sandbox Code Playgroud)
我可以在终端中很好地运行这行代码,但是当我00-header
使用此信息进行编辑时,我会以纯文本形式打印出转义码:
Welcome to \e[1;36mUbuntu 13.10\e[0m \e[2m(GNU/Linux 3.11.0-23-generic i686)\e[0m
Run Code Online (Sandbox Code Playgroud)
如何为当天的信息添加一点色彩?
我想要一个动态的 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 /run/motd.dynamic
# and a static (admin-editable) part from /etc/motd.
session optional pam_motd.so motd=/run/motd.dynamic
session optional pam_motd.so noupdate
Run Code Online (Sandbox Code Playgroud)
我也对 systemd 感到困惑。
有没有办法做到这一点?有人可以提供一个简单的财富的例子吗?
在Ubuntu的GNU / Linux 12.04,我有一个用户johndoe
,其为部分sftponly
基团,设立sftp
到一个chroot
使用监狱
Subsystem sftp internal-sftp
Match Group sftponly
ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no
Run Code Online (Sandbox Code Playgroud)
在/etc/ssh/ssh_config
. 用户home
目录的所有组件都是 -root
拥有的目录,任何其他用户或组都不能写入,如man sshd_config
(下ChrootDirectory
)中所述。在他的chroot
监狱里,有一个可写的目录files
:
sudo groupadd sftponly
sudo mkdir -p /home/sftponly/johndoe/files
sudo useradd -d /home/sftponly/johndoe -g sftponly -s /usr/sbin/nologin johndoe
sudo chmod go-w /home/sftponly/{,johndoe}
sudo chown johndoe:sftponly /home/sftponly/johndoe/files
sudo chmod ug+rwX /home/sftponly/johndoe/files
Run Code Online (Sandbox Code Playgroud)
(将外壳设置/bin/false
为ssh
或 都不起作用sftp
。随着nologin
外壳 …
You have new mail
当您通过 SSH 登录时,我正在尝试修改显示在 MOTD 下方的消息。我的目标是使该消息更加明显(明亮的颜色会很棒),以便在我登录时引起我的注意。
运行 Gentoo 3.4.0
最近听说过 /etc/motd 文件后,我试图让它显示随机的 cowsay 命运。我编写了一些随机的 bash 脚本来充当守护进程,将 /etc/motd 作为命名管道提供,如某些论坛上所见。
我不认为脚本有任何问题,因为 cat'ing 管道工作得很好,但 MOTD 不会在登录时显示(使用常规文件有效)!
fira@nyan ~ % cat /etc/motd
_______________________________________
/ We didn't put in ^^ because then we'd \
| have to keep telling people what it |
| means, and then we'd have to keep |
| telling them why it doesn't short |
| circuit. :-/ |
| |
| -- Larry Wall in |
\ <199707300650.XAA05515@wall.org> /
---------------------------------------
\
\
.--.
|o_o | …
Run Code Online (Sandbox Code Playgroud) 我想在我的机器上设置一个自定义的 motd(“今日消息”)(目前是 Mac OS X 10.6.5,使用 Bash 和 Terminal.app)。
在/etc/
没有MOTD文件,所以我创建了一个与一些示例文本。但是当我重新启动终端时该消息没有显示。我试过logout
然后login
但它似乎仍然没有开始。
如果我这样做了ls -l /etc/motd
(如果有任何线索):
-rw-r--r-- 1 root wheel 30 7 Dec 11:58 /etc/motd
我错过了什么吗?
我的 /etc/motd 文件显示重复的消息。当我手动编辑它时,每当用户登录时,它都会返回到混乱的版本。我该如何阻止?我正在使用 Ubuntu 10.04
I have a custom shell in /bin/
that returns an echo and exists.
I have a user that is exclusively linked to that shell only so that when someone tries to ssh into the server using that user via pubkey only, the custom shell will echo something and exit immediately (closes the ssh conenction right after the echo).
The problem is that it's working but it's showing the default Ubuntu MOTD / Banner after the authentication, while i only want …