Adding Security Message to RHEL 5 Login Screen - linux

What are the steps to configure the login screen of Red Hat Enterprise Linux 5 to display a large paragraph of text?
Background Information: The text is a security warning required by the company I work for to be presented to all users prior to them logging in. They must be able to read the text prior to logging in.
We are using GDM and it does not read /etc/issue by default. I have placed a copy of the text under the [greeter] section in /etc/gdm/custom.conf. The issue is that the text is displayed on one line and runs off the screen.
Is there a way to present the whole paragraph in plain text without having to resort to using a rendered background image of the text such as how this DOE employee did?
Example of using image: http://cc.jlab.org/docs/security/banners/linux-graphical-banner.html

Place the text in a file, and point InfoMsgFile to the file.
[greater]
InfoMsgFile=/etc/motd

Related

Problem with Imagemagick import (import-im6.q16) jammy/gnome

I use Imagemagick's "import" (import-im6.q16) a lot for capturing screen data. And it works great on my primary workstation using the Mate desktop.
But I am trying to use it on Jammy/Gnome and it just hangs.
Nothing in any of the obvious logs (syslog,Xorg). Searched the web and the Imagemagick communities and come up empty.
Executing import tmp.png should turn the "cross-hair" cursor on and allow selection of a region of the default X display. Upon "mouse up", the selected region is written to the file specified. An existing file will be overwritten permissions permitting. The suffix should be an image file type or errors can occur (.pdf is an example).
Can anyone confirm this is broken or working with Gnome?

Script to paste a specific string into a text field with a hotkey

I am trying to find a way to paste a predefined string upon entering a specific keyboard sequence, on any app.
For example if I have to paste an url or a password into a field, I can have said password in a hidden script and when I press, say, [ctrl] + [5], it would write "example123" on the text field where my cursor is.
Ideally without copying to the clipboard (I'd prefer keeping what I have on my clipboard and also avoiding to paste a password or such by mistake elsewhere).
I have tried every solution I've found so far that include xclip, xdotool and xvkdb. All of them either do not work or are really inconsistent: They only paste the string sometimes, and when they do, it's usually only part of the string ("ample123" instead of "example123").
I thought of using compose key, which I heavily use anyway to write in french on an us keyboard, but it seems it only supports 1 character sequences, as nothing is printed when I modify my .XCompose to include custom output sequences of len > 1.
I am using Ubuntu 18.04 with Gnome as a DE. Ideally something that also works when logging back (like compose keys).
You need to walk the Document Object Model for either Gnome or your web-page. My concern is that with a desktop script you wont be able to access the web page because you will need to be able to establish a target to send string to. I see in your question that you tried using using "x{tool-name}" to grab the text field element. Delivering the sting really isn't the problem. The problem is getting the GUI element of text box pragmatically. The easiest way to get access to this in a user loaded web-page is with WebExtensions API which is how to make extensions for most modern browsers. Otherwise, if you can get away with only having access to Gnome's GUI I would try LDTP, it's a library used for testing, but it looks like it can be used for automation too.
For keyboard shortcuts:
It really shouldn't matter what the script is doing to how you want to activate it. I would just go to Gnome/Settings/Keyboard and set the path to where I saved the script to be the Command. If you go the WebExtension route, you will want to build the shortcut into your extension.

Linux - Colorizing Text in Files

I'm on CentOS 6, and I'm playing around with the Pre-Login file message, located here:
# vi /etc/issue
I want to add some custom text of mine, and colorizing that text.
Here's my file text for now:
----------------------------
Welcome to my Testing Server
----------------------------
I've used an example from a friend of mine, on his CentOS 5:
----------------------------
^[[47;31m Welcome to my Testing Server ^[[0m
----------------------------
I see it working fine on his box, as I ssh to it.
But I copied and pasted it into my /etc/issue file and it returns everything as text.
Am I missing something?
The ^[ is not a literal carat followed by a bracket, it is a control character. When copying from your friend's box to yours, the control characters have been taken literally and cease to work properly, see this for more information on colorizing /etc/issue

how can I extract text contents from GUI apps in linux?

I want to extract text contents from GUI apps,here are 2 examples::
example 1:
Suppose I opened firefox, and input url : www.google.com
how can I extract the string "www.google.com" from firefox using my own app ?
example 2:
open calculator(using gcalctool),then input 1+1
How can I extract the string "1+1" of calculator from my own program?
in brief ,what I want is to find out whether there is a way to extract the text contents from any widget of an GUI application
Thanks
I don't think there's a generic way to do this, at least not a very elegant one.
Some inelegant ideas:
You might be able to modify the X window system or even some toolkit framework to extract what is being displayed in specific window elements as text.
You could take a screenshot and use an OCR library to convert the pixels back into text for the interesting areas.
You could recompile the apps of interest to add some kind of mechanism for asking them questions.
You could use something like xtest to inject events highlighting the region of interest and copying it to the clipboard.
I believe firefox and gcalctool are for examples only and you just want to know in general how to pass output of one application to other application.
There are many ways to do that on Linux, like:
piping
application1 | application2
btw here is the Firefox command line manual if you want to start firefox on Ubuntu with a URL. eg:
firefox "$url"
where $url is a variable whose value can be www.mozilla.org
That sounds difficult. Supposing you're running X11, you can very easily grab a window picture ( see "man xwd"); however there is no easy way to get to the text unless it's selected and therefore copied to the clipboard.
Alternatively, if you only want to capture user input, this is quite easy to do, too, by activation the X11 record extension: put this in your /etc/X11/xorg.conf:
Section "Module"
Load "record"
#Load other modules you need ...
EndSection
though it may prove difficult to use too, see example code for Xorg/X11 record extension fails

Show image notification from bash script

What I'm trying to accomplish:
On Ubuntu 10.04 I'd like to display a small notification image in the corner of the screen and have the image fade out. I'd like to do it from the command line for use with bash scripts. Similar to "notify-send", "zenity", or "dialog" except
it displays images as well.
What I've found so far:
ImageMagick animate seems to be the only command line tool that can display an image and exit without user interaction.
Is there anything any better? I could write one myself but I thought there should already be something to do this.
gcin does the work. It shows full size images as notifications.
sudo apt-get install gcin
gcin-message -icon your_image.jpg
Extract of man gcin-message:
NAME
gcin-message - gcin's notification tool
SYNOPSIS
gcin-message [-icon file] [-text string] [-duration milliseconds]
DESCRIPTION
gcin-message displays notification image and/or text. It is useful for
filters to have interaction with users.
OPTIONS
-icon file
Display an image.
-text string
Display text string. The space character is not allowed.
-duration milliseconds
Time to show notifications.
However I suggest you to not use this tool, because its installation from the Ubuntu repository is not fine grained (6 MB of stuff and a chinese icon in the notification area).
See if you can get gcin-message out of the gcin package and put it into your own package (if this suits your needs).

Resources