Friday, June 4, 2010

QEMU-IMG

the qemu-img command for creating and manipulating disc images.


Creating an image

qemu-img create -f qcow2 your_image_name.qcow2 50GB

 will create a new blank image with 50GB in the qcow2 format.


also the qemu-img program can be used to convert images from one format to another. or add compression or encryption to an image.

convert an image

qemu-img convert -O qcow2 test.vmdk testqcow2


get information about an image

qemu-img info your_image

Wednesday, June 2, 2010

Linux Files and Folder Permission examples

understanding file permission... with some examples.

what is this drwxr-xr-x about?

first think to understand is that we have 4 fields

1. file type | 2. user | 3. group | 4. other





1. The first character in the field indicates a file type of one of the following:

d = directory
l = symbolic link
s = socket
p = named pipe
- = regular file
c= character (unbuffered) device file special
b=block (buffered) device file special

most of the times you will see "d" or "-" or "l"

2. the user (primary owner) permissions.


3. the group permissions.


4. and others

just try to remember

user = u
group = g
other = o



there are 3 types of access

1. read
2. write
3. execute

rwx


lets see some example

yaniv@yaniv-ub:/tmp/test$ ls -ld folder1/
drwxr-xr-x 2 yaniv yaniv 4096 2010-06-02 10:15 folder1/
yaniv@yaniv-ub:/tmp/test$
so we see drwxr-x-r-x

lets look at the 4 fields: d| rwx | r-x | r-x

field 1: d = directory
field 2: the user (primary owner) = read, write, execute
field 3: the group = read, execute
field 4: other = read, execute

to be continued soon...

Wednesday, September 24, 2008

configure VNC to disaply x:0 on Fedora Core 9

i had to enable VNC x:0 on my box at home...

this is how i did it...

Don't forget to create a backup for every file that you edit/change...


i have edited "xorg.conf"

Section "Screen"
Identifier "Screen0"
Device "Videocard0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
Option "SecurityTypes" "VncAuth"
Option "UserPasswdVerifier" "VncAuth"
Option "PasswordFile" "/home/Yaniv/.vnc/passwd"

EndSection
I have added the 3 last Options:

Option "SecurityTypes" "VncAuth"
Option "UserPasswdVerifier" "VncAuth"
Option "PasswordFile" "/home/Yaniv/.vnc/passwd"


i had to change the PasswordFile path to my password file...


also i had to create a new section

Section "Module"
Load "vnc"
EndSection



i did a reboot and every thing worked...

the result is i can VNC to my box and every thing i do can be seen on the monitor
this is called display 0

good luck
Yaniv Ferszt

Tuesday, September 23, 2008

enable public_html and use .htaccess and .htpasswd for security

so after installing at home the FC9 box i configured the "httpd.conf" to enable access to
"public_html" directory's and support for ".htaccess" and ".htpasswd" files.

this is how i did it... there are many other ways to configure it... this is my solution :-)

NOTE: create a backup for every file BEFORE YOU EDIT OR CHANGE IT.

enable "public_html"

edit httpd.conf
you have to enable "UserDir public_html "so search it and uncomment it.
also you MUST remove the "UserDir disable" line above (search it).

verify that "LoadModule userdir_module modules/mod_userdir.so" is enabled...
uncomment it if you have to...

in order that apache can access your home dir you have to grant it permissions to do so
this is ls -ld on my home dir.

"drwx-----x 48 Yaniv Yaniv 4096 2008-09-22 21:04 Yaniv"

you have to grant others execute permissions... so use
"chmod 701 your_home_dir" to grand others read on the folder.

create the "public_html" folder inside your home dir.
it must be with 755 permissions.
"drwxr-xr-x 2 Yaniv Yaniv 4096 2008-09-22 16:14 public_html/"

restart apache and thats it.
"/etc/init.d/httpd restart"


.htaccess and .htpasswd
ok lets configure user name and password authentication for "public_html" or every other folder inside it.


edit httpd.conf and search for:
# First, we configure the "default" to be a very restrictive set of
# features.

right below it should be some ""
change it to look like this:


Options Indexes FollowSymLinks
AllowOverride All
NOT REQUIRED (i think so) i have enabled it...
Indexes = it will enable the users that is accessing your_url.com/~user_name/ to see the content...
FollowSymLinks = enables you to create links and they are working...

REQUIRED

AllowOverride All = can be changed to be more specific settings... i have used All

save the changes... and restart apache.

now lets cd to your "public_html" folder

create file named ".htaccess" the dot is a MUST
edit the file (i use vi) and place this inside:
AuthUserFile /your_home_directory/public_html/.htpasswd
AuthName "Title for Protected Site"
AuthType Basic
Require valid-user


AuthUserFile = change the path to your home dir path with /.htpasswd that we will create soon :-)
AuthName = place some tilte there... Welcome to my site... bla bla
AuthType Basic = leave it
Require valid-user = leave it

save the changes and close the file.

now use the htpasswd command to create the ".htpasswd" file.

htpasswd -c .htpasswd your_name

this will create the ".htpasswd" file with your name and your password
the password is encrypted inside the .htpasswd file... :-)

to create more users... lets say you would like to give a friend access to this folder with his own credentials
just cd to the folder where the ".htpasswd" is we just created and use:
htpasswd .htpasswd his_name

and thats it.

now change the permissions for both files
".htaccess"
".htpasswd"
to "644"

it should look like this:
-rw-r--r-- 1 Yaniv Yaniv 103 2008-09-22 16:11 .htaccess
-rw-r--r-- 1 Yaniv Yaniv 58 2008-09-22 20:47 .htpasswd


it should work now...

good luck
Yaniv Ferszt






Tuesday, September 9, 2008

Installing the vx 6000 webcam on Fedora core 9

After google-ing and reading i got my MS webcam vx-6000 working on Fedoracore9

I found the solution that worked for me here
quick installation guide:


  • yum install git kernel-devel gcc

From a command-line prompt, cd to a directory where you want to download it, then run the command:
  • git clone http://repo.or.cz/r/microdia.git
This will create a folder named "microdia" which contains all the source code.
  • cd microdia
also i found out that you have to edit macrodia.h before compiling... read more here
  • vi microdia.h
i had to change 2 values...
modify the Vendor Id with the code of Microsoft 045E and
the Product Id of the model 624F with 00F4.
it has to look like this DO NOT COPY PASTE:

#define USB_0C45_VID 0x045e /** Vendor ID of MICRODIA

#define USB_624F_PID 0x00f4 SN9C201 + OV9650


Attention: Do _NOT_ under any circumstances use "$ sudo make".
There are no root privileges necessary at this point and
using them causes a never ending chain of different problems lateron.

  • make

Troubleshooting MAKE errors look here
or
http://groups.google.com/group/microdia/web/testing-microdia-driver-draft
you should find some answers almost at the bottom...


I used "cheese" to test my web cam... you can find it with yum...
  • yum search cheese

if every thing worked for you... you would like the microdia.ko to get loaded at boot right?

here we go:

  • strip -g microdia.ko
  • sudo cp microdia.ko /lib/modules/`uname -r`/kernel/drivers/media/video/usbvideo/
  • sudo depmod -a
also i had this error and i solved it with this:
http://groups.google.com/group/microdia/web/testing-microdia-driver-draft

Troubleshooting insmod errors

# insmod microdia.ko
insmod: error inserting 'microdia.ko': -1 Unknown symbol in module

See the output of #dmesg

the last few lines would be complaints about missing symbols, depending upon whats missing

you may not have loaded the modules that module depends on,
So it failed with those error messages. You would need to modprobe for that module's dependencies

Try

$ sudo modprobe videodev

$ sudo modprobe compat-ioctl32

then

$ sudo insmod microdia.ko

good luck :-)
Yaniv Ferszt

Thursday, July 10, 2008

T r u e C r y p t open-source disk encryption

If you ever need to encrypt files or partitions and you like open source.
You have to try TrueCrypt or http://www.truecrypt.org/
personally i have allot of information on my disk-on-key and laptop.
as you know portable devices can get stolen or lost...
this is a good solution to protect your digital information.

This little software is amazing.

you can create encrypted folders on your disk-on-key / HDD /etc

Main Features:



Main TrueCrypt Window



TrueCrypt Volume Creation Wizard – encryption algorithms

Tuesday, June 10, 2008

CoreConfigurator - Windows Server Core

Here is a very good tool created by Guy Teverovsky
Guy's Blog or http://blogs.microsoft.co.il/blogs/guyt/

please visit Guy's blog for the latest release...

this tool will help you configure Basic (and much more) features on Windows Server Core

Features available in the current release:

  • Product Activation
  • Configuration of display resolution
  • Clock and time zone configuration
  • Remote Desktop configuration
  • Management of local user accounts (creation, deletion, group membership, passwords)
  • Firewall configuration
  • WinRM configuration
  • IP configuration
  • Computer name and domain/workgroup membership
  • Installation of Server Core features/roles

After installing CoreConfigurator (supplied as MSI package), navigate to the folder where it has been installed and execute CoreConfigurator.exe





Thanks Guy for this tool