yboetz / motd

Collection of 'message of the day' scripts
889 stars 105 forks source link

Scripts will not run on login #22

Open joeySeal opened 3 years ago

joeySeal commented 3 years ago

Running ubuntu 20.04 server, all required packages are install, script files have the same permissions as the default scripts, sshd has printmotd set to yes. Any advice?


update-motd: /usr/sbin/update-motd /etc/update-motd.d /usr/share/man/man5/update-motd.5.gz /usr/share/man/man8/update-motd.8.gz
figlet: /usr/bin/figlet /usr/share/figlet /usr/share/man/man6/figlet.6.gz
lolcat: /snap/bin/lolcat
hddtemp: /usr/sbin/hddtemp /etc/hddtemp.db /usr/share/man/man8/hddtemp.8.gz
~$ ls -la /etc/update-motd.d/
total 44
drwxr-xr-x   2 root root  4096 Feb 27 09:20 .
drwxr-xr-x 128 root root 12288 Feb 27 09:03 ..
-rwxr-xr-x   1 root root    72 Jul 12  2020 00-hostname-color
-rwxr-xr-x   1 root root  1246 Jul 12  2020 20-sysinfo
-rwxr-xr-x   1 root root  1074 Jul 12  2020 30-zpool-bar
-rwxr-xr-x   1 root root  1084 Jul 12  2020 35-diskspace
-rwxr-xr-x   1 root root  1810 Jul 12  2020 36-diskstatus
-rwxr-xr-x   1 root root   883 Jul 12  2020 40-services
-rw-r--r--   1 root root   998 Jul 12  2020 README.md```
yboetz commented 3 years ago

Maybe UsePAM yes in sshd_config? Apart from that I have no idea.

wemiprog commented 3 years ago

I found solutions after hours of trying😅 Hope works for you too

with update-motd it works anyway. But not when logging in

my case: On ubuntu, lolcat is installed in /usr/games/lolcat Apparently there are restrictions for this folder. So I just moved lolcat to /usr/bin/ and it worked

You haven’t installed lolcat in games but try it anyway

if it worked I’ll create pull request for read me , so other user won’t have to try

yboetz commented 3 years ago

My lolcat is under /usr/games/lolcat (Ubuntu 20.04), works for me.

wemiprog commented 3 years ago

Okay strange 😅 I tried almost everything else 🙈

do you work as root or not?

yboetz commented 3 years ago

update-motd scripts should be executed as root, there are a few scripts that need root access. The one using lolcat should also work as non-root.

jon4hz commented 3 years ago

By default root doesn't has /usr/games/ in the $PATH. So it kinda makes sense that update-motd can't execute that. I had the same issue and also solved it by moving lolcat to /usr/bin/

I am not sure how it is with the installation with snap but I would imagine that there is a similar problem. I can only advise against using snap anyway....

Mike-Bros commented 2 years ago

Just wanted to add I had the same issue and moving from /usr/games/ to /usr/bin/ fixed it!

wojciehm commented 7 months ago

Just wanted to add I had the same issue and moving from /usr/games/ to /usr/bin/ fixed it!

Helped me as well. Thanks!