Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

1 votes
2 answers
3765 views
Why my /etc/motd doesn't show the welcome message at login?
I have a Debian/Linux virtual machine in VirtualBox. # uname -a Linux debian 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux # vi /etc/motd ########################## Hi, welcome to the server! ########################## ~ ~ ~ ~ ~ "/etc/motd" 6 lines, 84 characters written :wq...
I have a Debian/Linux virtual machine in VirtualBox. # uname -a Linux debian 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux # vi /etc/motd ########################## Hi, welcome to the server! ########################## ~ ~ ~ ~ ~ "/etc/motd" 6 lines, 84 characters written :wq! When I exit terminal and login as root, the message in /etc/motd doesn't appear. root@debian:~# How can I make the message appear?
Richard (11 rep)
Mar 2, 2021, 12:38 AM • Last activity: Jul 30, 2025, 09:06 PM
0 votes
0 answers
109 views
Motd ssh server with ascii image with 24 bit color (truecolor)
I cannot visualise an ascii art image in 24 bit colors when I log into my server via ssh. I have created a dynamic motd for my ssh server. Specifically in the file /etc/update-motd.d/10-logo there is this command: jp2a /etc/update-motd.d/ares.jpg --height=50 --background=dark --colors --color-depth=...
I cannot visualise an ascii art image in 24 bit colors when I log into my server via ssh. I have created a dynamic motd for my ssh server. Specifically in the file /etc/update-motd.d/10-logo there is this command: jp2a /etc/update-motd.d/ares.jpg --height=50 --background=dark --colors --color-depth=4 and everything works. If on the other hand I change --color-depth=24 then I no longer see anything, just the default motd message. If I run this command with --color-depth=24 immediately after connecting via ssh I see the image. And of course I also see it if I run this command with --color-depth=24 in the client terminal. It almost seems that at the time motd is created the terminal does not support truecolor, i.e. 24 bit colours. Whereas immediately before (in the client terminal) and immediately after (in the server terminal) it does support it. Is there a possibility to display the motd image in truecolour (24 bit)?
devnull (1 rep)
Apr 25, 2025, 01:18 PM • Last activity: Apr 25, 2025, 02:01 PM
12 votes
5 answers
18799 views
How to prevent "Last Login:" message from showing up when using sftp?
In Ubuntu GNU/Linux 12.04, I have a user `johndoe` that is part of an `sftponly` group, set up to `sftp` to a `chroot` jail using Subsystem sftp internal-sftp Match Group sftponly ChrootDirectory %h ForceCommand internal-sftp AllowTcpForwarding no at the end of `/etc/ssh/ssh_config`. All components...
In Ubuntu GNU/Linux 12.04, I have a user johndoe that is part of an sftponly group, set up to sftp to a chroot jail using Subsystem sftp internal-sftp Match Group sftponly ChrootDirectory %h ForceCommand internal-sftp AllowTcpForwarding no at the end of /etc/ssh/ssh_config. All components of the user's home directory are root-owned directories that are not writeable by any other user or group, as explained in man sshd_config (under ChrootDirectory). Inside his chroot jail, there is a writeable directory files: sudo groupadd sftponly sudo mkdir -p /home/sftponly/johndoe/files sudo useradd -d /home/sftponly/johndoe -g sftponly -s /usr/sbin/nologin johndoe sudo chmod go-w /home/sftponly/{,johndoe} sudo chown johndoe:sftponly /home/sftponly/johndoe/files sudo chmod ug+rwX /home/sftponly/johndoe/files (Setting the shell to /bin/false did not work with either ssh or sftp. With nologin as the shell ssh connects, shows "MOTD", and then disconnects, which is the expected behavior.) But sftp fails with the message Received message too long 1416128883. I know this failure is caused by "MOTD" (Message Of The Day), as sftp expects a "clean login." I have tried disabling all "MOTD" pieces on the server using the following, with (**these results**): * Adding PrintLastLog no and PrintMotd no to the end of /etc/ssh/ssh_config and restarting ssh using restart ssh. (**No effect**. Testing with ssh shows both "MOTD" and "Last Login:".) * Commenting out session optional pam_motd.so in /etc/pam.d/sshd. (**Prevents MOTD**. But there is no corresponding entry for "LastLog" so, testing with ssh, "Last Login:" still shows up and hence **sftp still fails**.) * Commenting out session optional pam_lastlog.so and session optional pam_motd.so in /etc/pam.d/login. (**No effect**. Testing with ssh shows both MOTD and "Last Login:".) * Creating the .hushlogin file on the client using touch ~/.hushlogin. (**No effect**.) I am out of ideas. Where else may this "Last Login:" message be coming from and how can it be disabled (ideally only for sftp and not for ssh logins, but, I imagine as sftp uses ssh, the message is going to be there either for both or none)?
0mid (490 rep)
Apr 19, 2014, 10:41 AM • Last activity: Mar 24, 2025, 02:17 AM
3 votes
1 answers
1571 views
After SSH login linux output a kernel version
I can't hide or delete the banner when I'm logging in via ssh. This is my example: "Linux aedd7472f871 6.1.0-kali5-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.12-1kali2 (2023-02-23) x86_64" [![enter image description here][1]][1] [1]: https://i.sstatic.net/0szHZ.png How do I delete this message?
I can't hide or delete the banner when I'm logging in via ssh. This is my example: "Linux aedd7472f871 6.1.0-kali5-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.12-1kali2 (2023-02-23) x86_64" enter image description here How do I delete this message?
umar3 (41 rep)
Mar 29, 2023, 03:34 PM • Last activity: Mar 8, 2025, 12:18 PM
2 votes
3 answers
4671 views
Update MOTD at ssh login on Debian
What's the most clean way to display a different quote from a file (line-seperated) as MOTD on every SSH login on Debian? In other words, how can I trigger a MOTD update on SSH login?
What's the most clean way to display a different quote from a file (line-seperated) as MOTD on every SSH login on Debian? In other words, how can I trigger a MOTD update on SSH login?
Jeff Huijsmans (131 rep)
Feb 10, 2014, 10:46 AM • Last activity: Mar 6, 2025, 08:48 PM
0 votes
2 answers
83 views
How do I get linux flavors, like Fedora, RHEL, Amazon Linux, and others that don't update motd on login to do so?
I am trying to get my Amazon Linux 2023 server to update the MOTD on login, not on a timer or by fiddling with the profile. I want a clean experience for users whether they re-exec their shell, or sudo.
I am trying to get my Amazon Linux 2023 server to update the MOTD on login, not on a timer or by fiddling with the profile. I want a clean experience for users whether they re-exec their shell, or sudo.
four43 (111 rep)
Jul 12, 2024, 05:58 PM • Last activity: Jul 12, 2024, 07:56 PM
22 votes
4 answers
46610 views
How do I use colors in the MOTD?
I edited [the default `/etc/update-motd.d/00-header`](https://gist.github.com/IQAndreas/e3e7d58d81328779f630), adding some color to make it easier to read: printf "Welcome to \e[1;34m%s\e[0m \e[2m(%s %s %s)\e[0m\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)" I can run that line...
I edited [the default /etc/update-motd.d/00-header](https://gist.github.com/IQAndreas/e3e7d58d81328779f630) , adding some color to make it easier to read: printf "Welcome to \e[1;34m%s\e[0m \e[2m(%s %s %s)\e[0m\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)" I can run that line of code just fine in a terminal, but when I edit 00-header with this information, I get the escape codes printed out in plaintext: Welcome to \e[1;36mUbuntu 13.10\e[0m \e[2m(GNU/Linux 3.11.0-23-generic i686)\e[0m How can I add a splash of color to the message of the day?
IQAndreas (10635 rep)
Jun 25, 2014, 03:06 AM • Last activity: Jun 23, 2024, 08:37 PM
32 votes
4 answers
30985 views
Bash .hushlogin, keep last login time and host
At my company, when I log into some servers, my last login and a huge banner are displayed: me@my-laptop$ ssh the-server Last login: Mon Feb 8 18:54:36 2016 from my-laptop.company.com ************************************************************************ * * * C O M P A N Y I N F O R M A T I O N S...
At my company, when I log into some servers, my last login and a huge banner are displayed: me@my-laptop$ ssh the-server Last login: Mon Feb 8 18:54:36 2016 from my-laptop.company.com ************************************************************************ * * * C O M P A N Y I N F O R M A T I O N S Y S T E M S * * * * !WARNING! Your connection has been logged !WARNING! * * * * This system is for the use of authorized personnel only. * * Individuals using this *computer system without authorization, * * or in excess of their authority as determined by the Company * * Code of Ethics and Acceptable Use Policy, are subject to having all * * of their activities on this system monitored, recorded and/or * * terminated by system personnel. * * If such monitoring reveals possible evidence of criminal activity, * * Company may provide said evidence to law enforcement officials, * * in compliance with its confidentiality obligations and all * * applicable national laws/regulations with regards to data privacy. * * * * This device is maintained by Company Department * * admin@company.com * ************************************************************************ me@the-server$ Of course, I don't want this huge banner displayed every time I login, but I would like to *keep the last login time and host displayed*. If I use touch ~/.hushlogin, the banner is not displayed, but I also lose the *last login information*. In fact, nothing at all is displayed: ssh the-server me@the-server$ How do I remove the banner but keep the last login time and host, like this: ssh the-server Last login: Mon Feb 8 18:54:36 2016 from my-laptop.company.com me@the-server$
Xion345 (759 rep)
Feb 8, 2016, 06:05 PM • Last activity: Apr 20, 2024, 05:56 PM
3 votes
2 answers
14059 views
How to display motd when starting a new shell
What parameters can be passed to the bash shell so that it displays the motd? Shouldn't `bash -l` display the motd?
What parameters can be passed to the bash shell so that it displays the motd? Shouldn't bash -l display the motd?
LINUX G33NYUS (776 rep)
Oct 11, 2017, 06:04 PM • Last activity: Apr 2, 2024, 11:29 AM
0 votes
1 answers
701 views
alpine update motd on login
Is there any way to update the `/etc/motd` file on login? The `/etc/profile` and `/etc/profile.d/*.sh` scripts are executed after the motd is already displayed on login so these methods don't work. I want to add dynamic details about the current IP address and display it in the motd. However, I can'...
Is there any way to update the /etc/motd file on login? The /etc/profile and /etc/profile.d/*.sh scripts are executed after the motd is already displayed on login so these methods don't work. I want to add dynamic details about the current IP address and display it in the motd. However, I can't find a way to update the motd before it gets displayed to the user logging in. Thanks!
EightBall (1 rep)
Feb 23, 2024, 09:28 PM • Last activity: Feb 29, 2024, 03:38 PM
0 votes
1 answers
162 views
How can root get access to SSH_TTY
I *think* that `SSH_TTY` is an environment variable set by `ssh` that holds the device node of the current virtual terminal; e.g. `/dev/pts/0`, `/dev/pts/1` , etc. I know that when I'm logged in to an SSH server, I can see the device node assigned to each session by simply entering `echo $SSH_TTY`....
I *think* that SSH_TTY is an environment variable set by ssh that holds the device node of the current virtual terminal; e.g. /dev/pts/0, /dev/pts/1 , etc. I know that when I'm logged in to an SSH server, I can see the device node assigned to each session by simply entering echo $SSH_TTY. And I can see *all* device nodes in use (at least under my username) by entering w or who from the terminal. I can use the value of $SSH_TTY in a script in ~/.profile (or ~/.bash-profile) to (e.g.) make decisions about which directory to open for each session. IOW, SSH_TTY has an assigned value by the time my login has progressed to reading ~/.profile. I'd also like to communicate the value of SSH_TTY to the user in the MOTD, but am currently unable to do this. I *think* this is because root runs all the scripts in /etc/update-motd.d at login, and root has no SSH_TTY. And so I've looked for a *work-around*. The only one I've found is this:
#!/usr/bin/sh
su pi -c echo "Greetings, I see you rode in on $SSH_TTY"
But this fails silently. How can I do this?
Seamus (3772 rep)
Feb 17, 2024, 08:22 AM • Last activity: Feb 28, 2024, 04:06 PM
1 votes
1 answers
81 views
Printing something specific to the user during login before password prompt
I would like to print something in the middle of a user login, related only to that user. In other words, this has to be after the user has typed in their username, but before they even start typing in their password. Is there a standard mechanism to do so, both for local logins and logins via SSH?...
I would like to print something in the middle of a user login, related only to that user. In other words, this has to be after the user has typed in their username, but before they even start typing in their password. Is there a standard mechanism to do so, both for local logins and logins via SSH? In case it matters, this is on Debian Bookworm. This question is different than https://unix.stackexchange.com/questions/130928/displaying-server-information-at-login-prompt-ubuntu , which is generic to all users, and other user-specific MOTD which only appear after the user has already typed in the password.
Paul Grinberg (123 rep)
Feb 22, 2024, 02:06 AM • Last activity: Feb 22, 2024, 04:24 AM
0 votes
1 answers
716 views
Remove motd banner from Amazon AMI Linux 2023
I'm trying to remove the motd banner in Amazon Linux AMI 2023 ``` , #_ ~\_ ####_ Amazon Linux 2023 ~~ \_#####\ ~~ \###| ~~ \#/ ___ https://aws.amazon.com/linux/amazon-linux-2023 ~~ V~' '-> ~~~ / ~~._. _/ _/ _/ _/m/' ``` I tried to look for these strings in /etc /var, but didn't find anything. It was...
I'm trying to remove the motd banner in Amazon Linux AMI 2023
,     #_
   ~\_  ####_        Amazon Linux 2023
  ~~  \_#####\
  ~~     \###|
  ~~       \#/ ___   https://aws.amazon.com/linux/amazon-linux-2023 
   ~~       V~' '->
    ~~~         /
      ~~._.   _/
         _/ _/
       _/m/'
I tried to look for these strings in /etc /var, but didn't find anything. It wasn't in the motd file. Where could this be?
daisy (55777 rep)
Jan 31, 2024, 01:39 AM • Last activity: Jan 31, 2024, 11:57 PM
1 votes
1 answers
122 views
debian bookworm how to expand displayed apt reason for holding package
Because of a kernelbug the debian people (can cause dataloss on ext4 filesystem) blocks kernel update (403 error forbidden) [bugreport][1] I set kernel packages on hold so it is not blocking the upgrade from other packages. But in a few days I'll have forgotten this (stroke broke something in head)....
Because of a kernelbug the debian people (can cause dataloss on ext4 filesystem) blocks kernel update (403 error forbidden) bugreport I set kernel packages on hold so it is not blocking the upgrade from other packages. But in a few days I'll have forgotten this (stroke broke something in head). So my question is how can I expand this The following packages have been kept back: linux-headers-amd64 linux-image-amd64 to something like this The following packages have been kept back: linux-headers-amd64 linux-image-amd64 (kernelbug) I hope it is clear what I want to achieve.
nobody (387 rep)
Dec 10, 2023, 09:34 AM • Last activity: Dec 10, 2023, 03:26 PM
0 votes
3 answers
5737 views
ssh login does not display motd while UsePAM = no
I have customized `/etc/motd` and it was displaying it correctly while login via `ssh`: ``` Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 2.6.32-042stab141.3 x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage * Ubuntu 20....
I have customized /etc/motd and it was displaying it correctly while login via ssh:
Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 2.6.32-042stab141.3 x86_64)

 * Documentation:  https://help.ubuntu.com 
 * Management:     https://landscape.canonical.com 
 * Support:        https://ubuntu.com/advantage 

 * Ubuntu 20.04 LTS is out, raising the bar on performance, security,
   and optimisation for Intel, AMD, Nvidia, ARM64 and Z15 as well as
   AWS, Azure and Google Cloud.

     https://ubuntu.com/blog/ubuntu-20-04-lts-arrives 


>>


Last login: Sun May 17 21:41:54 2020 from 37.30.54.65
Then I changed setting UsePAM to no and the result is:
Last login: Sun May 17 21:41:54 2020 from 37.30.54.65
I want to keep UsePAM as no and still see my welcome screen.
wujt (101 rep)
May 17, 2020, 09:14 PM • Last activity: Feb 15, 2023, 09:53 AM
0 votes
3 answers
3697 views
A new motd script will not run
I created a new script `99-wlan0-RWB` in `/etc/update-motd.d` which is world executable like all the others. It works when run on its own or via `run-parts`, but is not run when logging in: what's wrong? (I have the same problem on a Raspberry Pi where _none_ of the scripts in `update-motd.d` run.)...
I created a new script 99-wlan0-RWB in /etc/update-motd.d which is world executable like all the others. It works when run on its own or via run-parts, but is not run when logging in: what's wrong? (I have the same problem on a Raspberry Pi where _none_ of the scripts in update-motd.d run.) (Nothing in /var/log/syslog.)
$ ssh root@mini31
Linux mini31 4.19.0-18-amd64 #1 SMP Debian 4.19.208-1 (2021-09-29) x86_64
External IP: xx.yyy.zzz.www
 ______________________________________
/ 1st graffitiist: QUESTION AUTHORITY! \
|                                      |
\ 2nd graffitiist: Why?                /
 --------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
df: 43G (81%)
    O2: 1.65 GB / 3.3 GB
Lebara: 6.49 MB / 66 MB
up: 10 days, la: 1:0.11, 5:0.14, 15:0.10
mssql tempdb.mdf is 515M
CPU temp.: +52.0
No mail.
mini31 # cd /etc/update-motd.d/
mini31 # ./98-data
df: 43G (81%)
    O2: 1.65 GB / 3.3 GB
Lebara: 6.49 MB / 66 MB
up: 10 days, la: 1:0.18, 5:0.15, 15:0.10
mssql tempdb.mdf is 515M
CPU temp.: +50.0°C
mini31 # ./99-wlan0-RWB
wlan0 is up
mini31 #
Richard Barraclough (550 rep)
Dec 13, 2021, 08:32 PM • Last activity: Jan 18, 2023, 02:12 PM
1 votes
2 answers
345 views
script in /etc/update-motd.d/ not working
I have created a script `/etc/update-motd.d/foo` #!/bin/sh echo aaa exit 0 I would like this script to be executed on ssh login, and display the output. I have the folowing lines in my `/etc/pam.d/sshd`: session optional pam_motd.so motd=/run/motd.dynamic session optional pam_motd.so noupdate which...
I have created a script /etc/update-motd.d/foo #!/bin/sh echo aaa exit 0 I would like this script to be executed on ssh login, and display the output. I have the folowing lines in my /etc/pam.d/sshd: session optional pam_motd.so motd=/run/motd.dynamic session optional pam_motd.so noupdate which I expected should execute that script on ssh login. But that does not work, and nothing is printed on ssh login. The script is owned by root and has 755 permissions. What else do I need to do? I am using Debian 10.
Martin Vegter (598 rep)
Dec 20, 2022, 06:34 AM • Last activity: Dec 21, 2022, 09:05 AM
10 votes
2 answers
601 views
Can I customize the "You have new mail" message
I'm trying to modify the `You have new mail` message that is shown below MOTD when you login via SSH. My goal is to make that message more visible (bright color would be great) so it gets my attention when I log in.
I'm trying to modify the You have new mail message that is shown below MOTD when you login via SSH. My goal is to make that message more visible (bright color would be great) so it gets my attention when I log in.
JAN261202 (103 rep)
Feb 22, 2020, 11:48 PM • Last activity: May 25, 2022, 10:54 PM
1 votes
0 answers
64 views
Filename may prevent running in /etc/update-motd.d
I added a file to `/etc/update-motd.d` and it didn't run. And I added another and it did run. `99-wlan0-RWB` doesn't work. `99-wlan0` does work. At first I thought maybe it could be the second hyphen, but no, it's the `RWB`! The only thing I can think of is that my non-`root` user is `rwb`. It has t...
I added a file to /etc/update-motd.d and it didn't run. And I added another and it did run. 99-wlan0-RWB doesn't work. 99-wlan0 does work. At first I thought maybe it could be the second hyphen, but no, it's the RWB! The only thing I can think of is that my non-root user is rwb. It has taken me _months_ to find this 'feature'! What's going on?
Richard Barraclough (550 rep)
Jan 15, 2022, 08:47 PM • Last activity: Jan 15, 2022, 09:15 PM
2 votes
1 answers
4881 views
Re-Display MOTD in Linux/Deblin system that's already logged in
I am looking to re-display the MOFD in a Linux/Deblin system that is already logged in. I have already edited the etc\motd file and this does display my custom motd output in the terminal when I ssh in to my Linux/Deblin system. However, what I want ot do is to Re-display the motd when I clear the t...
I am looking to re-display the MOFD in a Linux/Deblin system that is already logged in. I have already edited the etc\motd file and this does display my custom motd output in the terminal when I ssh in to my Linux/Deblin system. However, what I want ot do is to Re-display the motd when I clear the terminal. for example, after I logged in via ssh and the motd is displayed I will then inupt the commands that I wish to run then i will enter the "clear" command to clear the terminal, what I want to do is redisplay the motd after I have cleared the terminal. the only way I know to redisplay the motd is to log out of the terminal then log back in. Is there a command to redisplay the motd without logging out and back in to the terminal? (via ssh)
user507048
Dec 21, 2021, 03:30 AM • Last activity: Dec 21, 2021, 07:24 AM
Showing page 1 of 20 total questions