motd icon indicating copy to clipboard operation
motd copied to clipboard

Scripts will not run on login

Open joeySeal opened this issue 4 years ago • 8 comments

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

joeySeal avatar Feb 27 '21 14:02 joeySeal

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

yboetz avatar Feb 27 '21 16:02 yboetz

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

wemiprog avatar Apr 11 '21 23:04 wemiprog

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

yboetz avatar Apr 12 '21 06:04 yboetz

Okay strange 😅 I tried almost everything else 🙈

do you work as root or not?

wemiprog avatar Apr 12 '21 10:04 wemiprog

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.

yboetz avatar Apr 12 '21 18:04 yboetz

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

jon4hz avatar Apr 23 '21 12:04 jon4hz

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

Mike-Bros avatar Aug 17 '22 15:08 Mike-Bros

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

Helped me as well. Thanks!

wojciehm avatar Mar 28 '24 17:03 wojciehm