我在我的 Ubuntu 15.10 Server 的目录80_own-motd
中添加了一个新文件。/etc/update-motd.d
#!/bin/sh
echo ">>>>>>Welcome to my Ubuntu Server<<<<<<<<<<
------------Questions to [email protected]"
输出sudo run-parts /etc/update-motd.d/
显示了预期的消息。当我重新启动服务器时,它显示与以前相同的消息。:/ 在这里您可以看到我的文件夹结构(80_own-motd
是我的新文件):
/etc/update-motd.d$ ls -la
insgesamt 44
drwxr-xr-x 2 root root 4096 Jan 23 09:00 .
drwxr-xr-x 125 root root 12288 Jan 22 06:47 ..
-rwxr-xr-x 1 root root 1224 Jan 13 15:03 00-header
-rwxr-xr-x 1 root root 1358 Feb 20 2014 10-help-text
lrwxrwxrwx 1 root root 46 Apr 30 2015 50-landscape-sysinfo -> /usr/share/landscape/landscape-sysinfo.wrapper
-rwxr-xr-x 1 root root 140 Jan 23 09:00 80-own_motd
-rwxr-xr-x 1 root root 149 Aug 22 2011 90-updates-available
-rwxr-xr-x 1 root root 299 Apr 12 2014 91-release-upgrade
-rwxr-xr-x 1 root root 142 Aug 22 2011 98-fsck-at-reboot
-rwxr-xr-x 1 root root 144 Aug 22 2011 98-reboot-required
“grep motd /etc/pam* -R” 的输出
/etc/update-motd.d$ grep motd /etc/pam* -R
/etc/pam.d/login:# This includes a dynamically generated part from /run/motd.dynamic
/etc/pam.d/login:# and a static (admin-editable) part from /etc/motd.
/etc/pam.d/login:session optional pam_motd.so motd=/run /motd.dynamic noupdate
/etc/pam.d/login:session optional pam_motd.so
/etc/pam.d/sshd:# This includes a dynamically generated part from /run/motd.dynamic
/etc/pam.d/sshd:# and a static (admin-editable) part from /etc/motd.
/etc/pam.d/sshd:session optional pam_motd.so motd=/run/motd.dynamic
/etc/pam.d/sshd:session optional pam_motd.so noupdate
请帮我 :)
答案1
很可能您需要将其添加UsePAM no
到您的/etc/ssh/sshd_config
文件中。这为我解决了这个问题。