Category Archives: Fedora

Fedora 25 and Brother MFC-1910W

The main problem for Fedora 25 and Brother MFC-1910W is a permission problem, as normal user you can’t connect to scanner via xsane so a udev rule is the answer ūüôā

 

Download and install the drivers  from brother site :

linux-brprinter-installer-2.1.1-1.gz

After the installation vi /etc/udev/rules.d/40-brother-libsane-type1.rules

#
# udev rules sample for Brother MFP
# version 1.0.0-1
#
# Copyright (C) 2012 Brother. Industries, Ltd.
#
# copy to /etc/udev/rules.d or /lib/udev/rules.d
#

ACTION!=”add”, GOTO=”brother_mfp_end”

SUBSYSTEM==”usb”, GOTO=”brother_mfp_udev_1″
SUBSYSTEM!=”usb_device”, GOTO=”brother_mfp_end”
LABEL=”brother_mfp_udev_1″

SYSFS{idVendor}==”04f9″, GOTO=”brother_mfp_udev_2″
ATTRS{idVendor}==”04f9″, GOTO=”brother_mfp_udev_2″
GOTO=”brother_mfp_end”
LABEL=”brother_mfp_udev_2″

# ATTRS{bInterfaceNumber}==”01″, GOTO=”brother_mfp_udev_3″
# ATTRS{bInterfaceNumber}==”02″, GOTO=”brother_mfp_udev_3″
# ATTRS{bInterfaceNumber}==”03″, GOTO=”brother_mfp_udev_3″
# GOTO=”brother_mfp_end”
# LABEL=”brother_mfp_udev_3″

ATTRS{bInterfaceClass}!=”0ff”, GOTO=”brother_mfp_end”
ATTRS{bInterfaceSubClass}!=”0ff”, GOTO=”brother_mfp_end”
ATTRS{bInterfaceProtocol}!=”0ff”, GOTO=”brother_mfp_end”

MODE=”0666″
GROUP=”scanner”
ENV{libsane_matched}=”yes”
SYMLINK+=”scanner-%k”

LABEL=”brother_mfp_end”

reboot the system and all should works smoothly

VSFTPD Ftp Server

yum -y install vsftpd

The following configuration is used to allow anonymous users to access to the ftp and disables the localusers

vi /etc/vsftpd.conf

local_enable=NO
anonymous_enable=YES
write_enable=NO

anon_root=/var/ftp

chkconfig vsftpd on
/etc/init.d/vsftpd restart

Data privacy ( LUKS )

3-lukscryptsetup luksFormat /dev/vdb1 ( insert password )
cryptsetup luksOpen /dev/vdb1 crypdisk

now you can format the device pointing the dev mapper :

mkfs -t ext4 /dev/mapper/vdb1

mkdir /secret ; mount /dev/mapper/cryptdisk /secret

vi /etc/passfile

<password>

adding the config to crypttab :

cryptdisk /dev/mapper/vdb1   /etc/passfile

adding the config to fstab :

/dev/mapper/vdb1     /secret      ext4    defaults 0 0

Simply PHP and Libvirt api examples

200px-Libvirt_logo.svg

 

 

<?php
echo “WebAdmin 0.1Beta”;
echo “<br/>”;

$uri=”qemu+tcp:///system”;
$credentials=Array(VIR_CRED_AUTHNAME=>”root”,VIR_CRED_PASSPHRASE=>”xxxx”);
echo (“Connecting to libvirt (URI:$uri)\n”.”<br/>”.”<br/>”);
$conn=libvirt_connect($uri,false,$credentials);
if ($conn==false)
{
echo (“Libvirt last error: “.libvirt_get_last_error().”\n”);
exit;
}
$pools=libvirt_list_storagepools($conn);

echo “Storage Pool :”; echo “<br/>”;

for ($x = 0, $m = count($pools) ; $x < $m ; $x++)
{
$storeinfo= $pools[$x] ;
echo $storeinfo ;
echo “<br/>”;
$pool=libvirt_storagepool_lookup_by_name($conn,$storeinfo);
$volumes=libvirt_storagepool_list_volumes($pool);

echo “Storage Pool Details:”;
echo “<br/>”;
$storifoext=libvirt_storagepool_get_info($pool);

foreach($storifoext as $key => $value)
{
echo $key. ” : ” . $value . “<br/>”;
}

echo “<br/>”;
echo “Volumes”;
echo “<br/>”;
for ($y = 0, $o = count($volumes) ; $y < $o ; $y++)
{
echo $volumes[$y];¬† echo “<br/>”;

}
}
echo “<br/>”;
$doms = libvirt_list_domains($conn);
echo (“Domains :”.”<br/>”);
echo “<br/>”;
for ($i = 0, $n = count($doms) ; $i < $n ; $i++)
{
echo $doms[$i] ; echo “<br/>”;

}

echo “<br/>” ;
$cdoms= libvirt_domain_get_counts($conn);
echo (“Total¬†¬†¬† : ”¬† . $cdoms[total]); echo “<br/>”;
echo (“Active : ”¬† . $cdoms[active]); echo “<br/>”;
echo (“Inactive : ”¬† . $cdoms[inactive]); echo “<br/>”;

?>

This is the output :

WebAdmin 0.1Beta
Connecting to libvirt (URI:qemu+tcp:///system)

Storage Pool :
default
Storage Pool Details:
state : 2
capacity : 371561320448
allocation : 306486804480
available : 65074515968

Volumes
w7.img
Fedora_17_x86_64-2.img
OST_01-2.img
ad-01.img
Cloudify.img
Fedora_17_x86_64.img
Fedora_17_x86_64-1.img
Foreman-02-clone-1.img
Foreman-02-clone.qcow2
Foreman-02.vmdk
OST_01-3.img
Centos-6_clean.img
Centos_01.img
Centos-6_clean-1.img
Fedora_17_x86_64-3.img
Foreman-02.img
Foreman-02-clone-2.img
Foreman-02-clone.img
Centos_02.img
OST_01-1.img
Centos-6-x86_64.img
Centos-6-Puppet.img
OST_01.img

Domains :

Centos_02
Foreman-02-V1-clone
Foreman-02-V1
Centos_01
Fedora_17_x86_64
Foreman-02-clone
w7
Cloudify
OST_01

Total : 9
Active : 0
Inactive : 9