Silence login info when not using a display manager - linux

I want to silence the login info provided in tty after the boot-log/boot-screen and drop me directly to shell. What I get after the boot-screen is complete.
Run 'nixos-help' for the NixOS manual.
CosPi login: creator54 (automatic login)
after this I get a shell prompt.
I know I could just add a clear on topmost of my shell config, but it takes some time to reach the shell after the boot-log/boot-screen is complete and the OS gets stuck in this info for few(~15) seconds. So adding clear does't do much here as i'll still see the info.

If you can control what files the home of the user you are logging in contains, you can disable the messages by adding the file .hushlogin to the home directory. It does not have to contain anything, just do
touch .hushlogin
(I have not used this on NixOS, but this .hushlogin is a very old feature that works on other Linux distributions, and also on Solaris, FreeBSD etc).

Related

Hiding command prompt in a cuckoo report screenshots

I am analyzing malware using cuckoo. But in the reports generated, the content on screen is hidden due to the command prompt running on the host machine. Is there a way to hide this command prompt? I tired:
cuckoo submit -o arguments="- windows minimized" /path/to/binary
and
cuckoo submit -o arguments="/min" /path/to/binary
But still in the final screenshots of the host machine, I can see the command prompt and it is hiding stuff behind it that I need to see.
It may be that you need to keep your VM up-to-date and ready for analysis(open separately, run or cancel(depending on your approach) updates etc.) and save that state to the pristine state you will be using for analysis.
It also means that regular issues with workstations might apply:
Without knowing much details about your analysis box, you can try guides like this

Need to schedule Cygwin Expect Script with Windows Task Scheduler

I am currently in the process of implementing a backup scheme to run a Cygwin Expect Script. What I would like to do is have task scheduler open Cygwin and run an expect script called Backups.
The issue that I run into is what I believe to be either variable or path based. I have the correct user from Active directory (we'll call it AD/svc_backup) set, and I am currently trying to just see if I can get the task scheduler to open Cygwin.
So far it will only open the program if I have the run only when user is logged on radio button pressed. This will open cygwin, but not let me run any further commands and gives me an error.
For example ls gives me "bash: ls: command not found" When it asks what program I want to start, I simply point it to the shortcut on my desktop and it then fills in the path C:\cygwin\bin\mintty.exe . Task scheduler does not seem like the most intuitive tool IMO but if I can get it to work I will use it. I also know that cygwin can use cron as well. Would cron be a better option?
I figured it out. So what the system means by the button "run only when user is logged on" radio button pressed" means is I want the script to run and I want to see it run with the local usr account. (interactive with the user)
The "run whether the user is logged in or not" button turns whatever script or program you run into a background service that has no user interactivity( you cant see it). By using the full path under the actions tab in cygwin I was able to tell it which script to run. Script path and options are like so:
C:\cygwin\bin\bash.exe -l -c C:/cygwin/home/svc_p_cisco_bkp/
I have been researching the -l and -c arguments and from what I can gather the -l means list the output and the -c means run these commands. This was not listed anywhere but from what I read it is as educated of an answer as I can give. Also I tested and the script will not run correctly without these variables.
I don't see the script start when I check the "run whether the user is logged in or not" button, but I can see the backups going to my destination folder. I do see it when "run only when user is logged on" however. What I did was get the script running the way I wanted while I could see it and then choose the "run whether the user is logged in or not" radio button when I know it was working correctly.
All is up and running and after exhausting reading of pages and pages about Windows task scheduler, and I am fully automated.

Same program behaves differently in different consoles

I wrote a text mode batch C++ program that since today is giving me some troubles.
The executable worked correctly and it did not change.
The environment did not change; not even a reboot.
When I launch the program from a certain console, everything is fine.
When I launch the program from a new console, everything still works, but I get just the first two lines on the log file, even if the execution completes.
The parameters passed to the executable are the same.
The executable does not interact with the console in any way.
The two consoles' environment variables are the same.
When run from a remote computer as root, everything is fine, the log file is complete.
When logged in again with my user, from another session, everything is fine again.
When logging out and in again, everything is fine again.
So, could it be the from a certain instant on, the new consoles had some issues that caused this problem?
Could this be a problem of my Linux installation?
Or, more realistically, could the problem depend on my program?
Thank you!
Environment:
- Linux OpenSuse 11.4
- gcc 4.5.1
Here is another tool to throw into your debugging toolbox.
Try the command 'reset' -- read the man page for details.
In short, it resets the console to a known state. It is ... possible that your log files may contain control characters that try to interact with tty causing hard-to-trace problems.
You might also want to look at the command 'script' which captures all console activity to at et file for examination.

How do I logout from a computer using shell?

How can I log out of my computer using shell such the log-in window appears again?
I need this functionality in one my Linux script.
Update:
I want to replicate the code working behind the Logout button of my Ubuntu.
Desktop Enviroment being used: GNOME
I think this does the job:
gnome-session-save --logout
Also, take a look at the --help output, maybe you want to use the --force-logout option.
Usage:
gnome-session-save [OPTION...]
Help Options:
-h, --help Show help options
--help-all Show all help options
--help-gtk Show GTK+ Options
Application Options:
--logout Log out
--force-logout Log out, ignoring any existing inhibitors
--logout-dialog Show logout dialog
--shutdown-dialog Show shutdown dialog
--gui Use dialog boxes for errors
--display=DISPLAY X display to use
Your question is a bit vague. Are you trying to log out of a graphical session of a desktop environment (such as KDE/Gnome), as if the user clicked on "log off"?
Then you need to find out if/how the desktop environment supports scripting to log out. On KDE for example you can use kquitapp.
Try restarting the display manager using one of the following, depending one which one you're using. You'll obviously have to have the proper permissions.
/etc/init.d/xdm restart
/etc/init.d/kdm restart
/etc/init.d/gdm restart
It's a bit of a hack, but the way that screen's power detach does this is to determine its parent pid and send it a SIGHUP. (Clarification: This closes only the shell, so only works if you're running from a console - not a graphical login - so may not be what you're looking for.)
Type in terminal
gnome-session-quit
or
pkill -kill -u {Username}

ssh and window ids

I have a project to do in school which is baffeling me... I am SSHing into a Solaris computer in the computer lab from my own Debian box via
ssh -Y name#***.cs.<school>
I can get in just fine, and the X11 seems to be working also. However, this peticular project requires us to find the window id of a netscape window via xwininfo and use this information in the following command
netscape -id 0xa00029 -remote 'openFile(/path/to/html/file)'
Now, if this netscape is the only window I have open (other than xterm), the preceding command works just fine. However, if I have any other iceweasel windows open (regardless of the order in which I opened netscape/iceweasel) the command will forward to my iceweasel despite the facts that I'm running the command in my SSH session and the two windows have very different window ids.
All of this eventually has to go into a C program, but I can't even get it to work reliably manually!
Any ideas?
P.S. I just saw this that may help. When I SSHed via Cygwin/X using the same command, I get this error
Warning: No xauth data; using fake authentication data for X11 forwarding.
Not sure if this is important as I can still use X11 (aparently) perfectly.
Thanks.
P.P.S the -id switch is documented in the netscape man pages:
-id window-id
Identifies an X window to receive -remote commands. If
you do not specify a window, the first window found is
used.
When you use ssh -Y, you're requesting that remote clients be forwarded to your local X server, with full permissions. The Netscape/Mozilla/Firefox/Iceweasel/Etc. remote protocol runs through the X server, so it'll be forwarded too.
http://www.mozilla.org/unix/remote.html documents the protocol, and mentions nothing about -id. Nor does a very quick look at the source (e.g., http://mxr.mozilla.org/seamonkey/source/widget/src/xremoteclient/XRemoteClient.cpp#202) look promising for there being an -id option.
I sat down to an actual machine to perform the same tests, and they all fail there too... I would open 2 netscape windows and try to direct the command to one at a time. The most recently opened one would work properly, but any command directed to the other one would be forwarded to the same window, so at this point I am convinced that the problem lies in the command being not properly implemented and/or everything on that system being really, really old.
if I have any other iceweasel windows
open (regardless of the order in which
I opened netscape/iceweasel) the
command will forward to my iceweasel
despite the facts that I'm running the
command in my SSH session and the two
windows have very different window ids
Iceweasel is coded that way. It tries to have only a single process run for all open windows for that user.
Use the -no-remote command line option to avoid it. See http://kb.mozillazine.org/Command_line_arguments

Resources