SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
There seems to be some miscommunication here.
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.
My goal here is not to silence the login, but to have the MOTD execute with scripts in it. EG. Welcome back, `whoami`
AFAIK this has always been the purpose of /etc/issue.
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.
Last edited by Didier Spaier; 01-28-2015 at 04:01 AM.
Reason: EDIT added.
As you can see above, this is what my MOTD looks like when i log in as root. This is what i want.
However, when i log in as a normal user, i get the following;
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.
Last edited by Didier Spaier; 01-28-2015 at 04:32 AM.
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.
The reason it is being exectuted for for root, is because i did chmod +x /etc/motd. I am wanting the +x attribute to apply for users as well. But for now im fine with hushlogin and calling the script from .bashrc.
/etc/rc.d/rc.S.orig:# Update the current kernel level in the /etc/motd (Message Of The Day) file,
/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
Last edited by c94p67; 01-28-2015 at 05:48 AM.
Reason: with-ir
It is technically impossible that "/etc/motd" is executed as a script, unless you are doing so from "/etc/profile" or "/etc/profile.d/" or doing something else.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.