MOTD script not running for normal user
I have a MOTD script that wont execute for normal users, instead it only gets echoed. It works for root though. What am i missing here?
I did try and chmod +x /etc/motd to no avail. |
First, I suggest reading the man pages for login and login.defs. Check /etc/login.defs for definition of HUSHLOGIN_FILE and then check for that file. If the HUSHLOGIN_FILE variable in /etc/login.defs is a full path, then it will hush login chatter if the user's name or shell are found in the file; if not a full path, then the mere existence of the named file in the user's home directory will hush login chatter.
Cheers |
Quote:
My goal here is not to silence the login, but to have the MOTD execute with scripts in it. EG. Welcome back, `whoami` This works perfectly fine when i login to the root account, but for normal users the result is "Welcome back, `whoami`" |
Ah. I've never heard of a motd `script`. Documentation I've read mentions that the MOTD file(s) will be displayed, not executed. I did not read your issue correctly, true. I inferred that the motd wasn't being displayed. Was trying to point out ways in which you could find out if motd was already being hushed (obviously not the problem). If you want some specific scripts to run on login, perhaps look at adding them to /etc/profile.
|
You could try setting LOGIN_STRING. See "man login"
|
Setting LOGIN_STRING will set the prompt string. Default is "Passord: ". MOTD is for after successful login.
|
Quote:
EDIT. statement above was wrong, see next post from j_v. That's one also (a specific version) among the first things you see when you install Slackware. Oh and a reminder for newcomers who could happen to read this: there are messages that one get only in a login shell, e.g. running "su -" instead "su", like the one displayed by "fortune" if bsd-games is installed. |
/etc/issue is displayed before the password prompt, not after successful login. Defined by ISSUE_FILE in /etc/login.defs.
|
Quote:
|
I must be terrible at explaining my self. I dont understand why this is such a big problem hehe.
I will therefor show you want i want and what i actually get. Code:
However, when i log in as a normal user, i get the following; Code:
|
What is really strange is that the script be executed when you log in as root: it shouldn't, and it is not here.
Please read "man motd". As j_v pointed out, if you want that this script be executed at each login you should put it elsewhere. /etc/motd should be just a message displayed as-is. |
solb
Quote:
Thanks. |
Can you please execute:
Code:
grep -ir motd /etc/ 2>/dev/null |
Quote:
/etc/rc.d/rc.S.orig: /bin/sed -i "{1s/^Linux.*/$(/bin/uname -sr)\./}" /etc/motd /etc/rc.d/rc.S:# Update the current kernel level in the /etc/motd (Message Of The Day) file, /etc/rc.d/rc.S: /bin/sed -i "{1s/^Linux.*/$(/bin/uname -sr)\./}" /etc/motd /etc/login.defs:MOTD_FILE /etc/motd /etc/login.defs:#MOTD_FILE /etc/motd:/usr/lib/news/news-motd /etc/X11/app-defaults/XLock:!XLock.messagefile: /etc/motd /etc/ssh/sshd_config.orig:#PrintMotd yes /etc/ssh/sshd_config:#PrintMotd yes |
shadow-4.2.1.tar.xz:/shadow-4.2.1/libmisc/motd.c:
Code:
fp = fopen (motdfile, "r"); What version of Slackware are you running? |
All times are GMT -5. The time now is 11:40 PM. |