It seems to me that I misunderstand something because of the fact that English is not my first language.
The problem is explicitly described in the question. I run Windows XP using qemu from Linux and I want to manipulate it using virsh. But I have no idea how to obtain the domain (name, id or whatever) of the guest vm. How to deal with it?
Run a Command Prompt and type :
wmic computersystem get domain
Or
For the Domain name of a computer type
systeminfo | findstr /B /C:"Domain"
Related
I'm using apparmor as hardening layer for libvirt-qemu , everything is OK , but there is one thing that I can't solve systematically, let me explain :
When create a new qemu instance , profile is generated from /etc/apparmor.d/libvirt/TEMPLATE.qemu to a file with path /etc/apparmor.d/libvirt/libvirt-81303229-df4c-4b18-b33b-277bcda81b0f for example .
When instance is shut-off profile is unloaded from kernel by apparmor and it is OK as expected. But if i remove the instance definitively, i would expect that profile is removed also from filesystem, but it is not and still present in filesystem. After some time I have very big mess in libvirt instance profile files
Yes .. I can write a cron job what will be delete unnecessary libvirt profile files ... but ..is there some more clear solution , maybe builtin function of apparmor ?
Thanks
Are you using libvirt undefine to delete the stopped guest? It appears that virt-aa-helper should delete an undefined domain but I think it is a bug and you should file a ticket.
You can use the virt-aa-helper command directly to remove the files which is probably the safest as it should deal with the dependencies for you.
An example command is:
$ sudo /usr/lib/libvirt/virt-aa-helper -D -u libvirt-3c3d5aa2-f581-457d-b5ab-efbf9fdd4a6e
But it may be some edge case that they need to account for, where you can undefine a running instance to convert it to ephemeral. You would need to take care of that edge case.
Note: Because virt-aa-helper is intended to be run by libvirt you will have to use sudo with the command. If you do not it will silently fail and not remove the profile.
We're doing an audit and we want to know which asset tags have which service tags.
The plan is to append a startup script that when triggered, sends the hostname, svc tag and model number to a .csv which is located on a server share.
Here is a snippet:
net use x: "\\server\path"
wmic os get csname >> x:\2016Audit.csv
wmic csproduct get identifyingnumber,name >> x:\2016Audit.csv
net use x: /delete
So we map the UNC path locally, run the two WMIC commands, write the results to .csv on the mapped drive, and then delete the mapped drive.
This works fine when run from within Windows (Windows 7 Pro x86) however run as a startup script the script fails. The script itself runs, I know this for a fact, but the results aren't written to the server share.
Any ideas?
Or, if you can think of an entirely different way to approach this, let me know. Bare in mind that we have 1500 PC's.
Thanks,
Elliott
wmic os get csname >> "\\server\path\2016Audit.csv"
wmic csproduct get identifyingnumber,name >> "\\server\path\2016Audit.csv"
Also type wmic /output /? and wmic /append /? for help on wmic own writing to file ability.
Here's a sample command that shows wmic capabilities.
wmic /node:"#%userprofile%\desktop\ComputerName.txt" /output:"%userprofile%\desktop\NicSpeed.html" /failfast:on nic where (PhysicalAdapter=TRUE and Speed!=100000000) get systemname,speed,caption /format:htable
Mapped drives are for old programs.
C:\Users\User>wmic csproduct get identifyingnumber,name /format:csv
Node,IdentifyingNumber,Name
DESKTOP-UCDGI39,CND5382Y72,HP Notebook
See wmic /format /?.
When querying computers on a network use the /failfast switch. It will skip unavailable computers quickly. See wmic /failfast /?.
Use net view to get a list of computers to use in the node command. Remove \\ from the file. See wmic /node /?.
Here's a sample computerlist.txt, you can mix and match computer names and ip addresses.
serenity
127.0.0.1
Background
Coming from a mysql background, I find getting started with Oracle quite a different experience.
Question
Where do I find this command tool for Oracle?
I have checked wikipedia and it only says:
An Oracle programmer in the appropriately configured software environment can launch SQL*Plus
And it's not in the PATH on my Windows:
C:\Users\jeff>sqlplus
'sqlplus' is not recognized as an internal or external command,
operable program or batch file.
You can locate the sqlplus executable in Windows by running in a CMD shell
dir /s /b c:\sqlplus.exe
Suppose you find the file at
c:\oracle\product\11.2.0\client_1\bin\sqlplus.exe
Then you have determined that your ORACLE_HOME is:
c:\oracle\product\11.2.0\client_1
Assuming the above ORACLE_HOME, set your environment variables (Control Panel > System > Environment Variables). Below is example, so modify these to match the ORACLE_HOME you determined above.
ORACLE_HOME=c:\oracle\product\11.2.0\client_1
TNS_ADMIN=c:\oracle\product\11.2.0\client_1\network\admin
PATH= *(add this below the end of your PATH)*
;c:\oracle\product\11.2.0\client_1\bin
Usually in $ORACLE_HOME/bin and usually they suggest to run
. oraenv
to prepare your environment.
If you are running Oracle Server on your local computer you can also find it by right clicking the running Oracle process:
In my case it is in
C:\app\TZNind\virtual\product\12.2.0\dbhome_2\bin
Problem: For example, Missing files in WINDOWS.X64_193000_db_home folder.
Solve: Reinstall oracle db. The exact solution.
enter image description here
enter image description here
I created a binary executable from bash script on linux server through SHC. The binary created works fine on linux machines, but through mistake on Mac. How could I convert my bash file to binary executable that is able to run everywhere(ubuntu, CentOS, Mac, Cygwin)?
shc -v -r -T -f ir16fetcher.sh
mv ir16fetcher.sh.x ir16fetcher
Shebang of my bash script
#!/bin/bash
On Linux machines
./ir16installer
USAGE : ir16fetcher <servername/ip address> [the n th latest build - optional. Default 1]
EXAMPLE: ir16fetcher jagger 2
EXAMPLE: ir16fetcher 167.116.6.155
REQUIRE: Please make sure conf file in installation folder ~/IRinstall/ir16 & ~/IRinstall/irmanager
On my Mac
./ir16installer
-bash: ./ir16installer: cannot execute binary file
I think it's not gonna work
"The compiled binary will still be dependent on the shell
specified in the first line of the shell code (i.e.
#!/bin/sh), thus shc does not create completely independent
binaries."
From http://www.datsi.fi.upm.es/~frosal/sources/shc.html
You will have to do this for every architecture and operating system you need to support. In any case, there doesn't really seem to be any benefits of using this method for distribution. It adds dependencies and complicates delivery, and I'm pretty sure whatever obfuscation the "shc" compiler implements is easily reversed.
if the goal here is to "hide" your source code, and then have the "hidden" copy of the code be executable on the Unix OSes you listed, then, encryption is really your only option.
I say this because encryption tools are available on every base Unix install. For your purposes, this is a very good thing as you wont have to download or configure anything additional. They're just there, as part of the natural installation of the OS. One of such tools is called openssl.
To Encrypt your file/script with openssl:
echo precious-content | openssl aes-128-cbc -a -salt -k mypassword
U2FsdGVkX1+K6tvItr9eEI4yC4nZPK8b6o4fc0DR/Vzh7HqpE96se8Fu/BhM314z
To Decrypt your file/script with openssl:
echo U2FsdGVkX1+K6tvItr9eEI4yC4nZPK8b6o4fc0DR/Vzh7HqpE96se8Fu/BhM314z | openssl aes-128-cbc -a -d -salt -k mypassword
precious-content
Now, to get openssl to do what you want it to do automatically without having to spend hours of your own time figuring out a way, you can paste your script to a site like www.EnScryption.com. This site will generate an "executable" version of your code for you, which you can then run on any Mac, Ubuntu, RedHat, CentOS box.
My ultimate goal is to do telnet to a router and interact with it. The following expect script does not help me at all. The router does not have any user id or pasword. it is automatic login.
Expect file code.
set iptotelnet "10.x.x.x"
spawn telnet $iptotelnet
sleep 10
expect ">" #this is because initially the prompt will be >
sleep 10
send "enable\r" # this should change the prompt from > to #
sleep 10
expect "#"
sleep 10
interact
sleep 10
exit
However, I get the following error.
send: spawn id exp4 not open
while executing
send "enable\r".
This is not just with telnet, i get the same error with any other command also.
please help me.
Your script has no major issues with it, not that would cause spawn to fail like that. (The comments you have would cause problems, but are trivially fixable by using ;# instead of #.) Therefore your problem lies elsewhere (well, with very high probability).
I see that you are trying to control telnet with Expect on Windows. Alas, telnet is a special case that can't be controlled this way — Expect on Windows uses the system debugging facilities to intercept terminal output, but this doesn't work for executables that have special system permissions set, and telnet is one of the programs for which this is true — so you need another approach. The simplest is to get plink.exe (which is really PuTTY for terminals/automation) and to use that (in “telnet” mode) instead of telnet.
Probably you can't use # comments in send command line.
Try same but without comment in send string.
It happens to me too. And it has been resolved.
I try to automatically telnet a server in the Cygwin on Windows.
But the Microsoft telnet installed in Windows won't work in a Cygwin shell
If you got the response below, this is the source of your problems type:
$ which telnet
/cygdrive/c/WINDOWS/system32/telnet
There are two solutions:
1. For Cygwin x86, just simply install the package "inetutil" which includes telnet command.
2. For Cygwin x86_64, currently(2013-09-09) the "inetutil" hasn't been port to 64bit, so I use the plink.exe which is part of PuTTy instead